From b34ac2243482c526135cadb9c7f1cc6f0c224ea6 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 6 Mar 2020 19:53:11 +0300 Subject: [PATCH] [rpc/server] fix getblock verbose response - Nonce should not trim leading zeros - NextConsensus should returns address (uint160 -> base58) --- pkg/rpc/response/result/block.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/rpc/response/result/block.go b/pkg/rpc/response/result/block.go index 440161490..080224563 100644 --- a/pkg/rpc/response/result/block.go +++ b/pkg/rpc/response/result/block.go @@ -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,