Merge pull request #734 from nspcc-dev/fix/getblock-response

[rpc/server] fix getblock verbose response
This commit is contained in:
Roman Khimov 2020-03-06 20:10:14 +03:00 committed by GitHub
commit 1b7b9e74d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,11 +1,12 @@
package result
import (
"strconv"
"fmt"
"github.com/nspcc-dev/neo-go/pkg/core"
"github.com/nspcc-dev/neo-go/pkg/core/block"
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
"github.com/nspcc-dev/neo-go/pkg/io"
"github.com/nspcc-dev/neo-go/pkg/util"
)
@ -41,7 +42,7 @@ type (
Time uint32 `json:"time"`
Index uint32 `json:"index"`
Nonce string `json:"nonce"`
NextConsensus util.Uint160 `json:"nextconsensus"`
NextConsensus string `json:"nextconsensus"`
Confirmations uint32 `json:"confirmations"`
@ -61,8 +62,8 @@ func NewBlock(b *block.Block, chain core.Blockchainer) Block {
MerkleRoot: b.MerkleRoot,
Time: b.Timestamp,
Index: b.Index,
Nonce: strconv.FormatUint(b.ConsensusData, 16),
NextConsensus: b.NextConsensus,
Nonce: fmt.Sprintf("%016x", b.ConsensusData),
NextConsensus: address.Uint160ToString(b.NextConsensus),
Confirmations: chain.BlockHeight() - b.Index - 1,
Script: b.Script,