rpc: use core Header for getblockheader response

Nonce and Primary fields were missing from response.
This commit is contained in:
Anna Shaleva 2021-09-09 16:13:59 +03:00
parent db13362e86
commit ed9cdfe667
3 changed files with 61 additions and 45 deletions

View file

@ -1455,17 +1455,12 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
t.Run("verbose != 0", func(t *testing.T) {
nextHash := chain.GetHeaderHash(int(hdr.Index) + 1)
expected := &result.Header{
Hash: hdr.Hash(),
Size: io.GetVarSize(hdr),
Version: hdr.Version,
PrevBlockHash: hdr.PrevHash,
MerkleRoot: hdr.MerkleRoot,
Timestamp: hdr.Timestamp,
Index: hdr.Index,
NextConsensus: address.Uint160ToString(hdr.NextConsensus),
Witnesses: []transaction.Witness{hdr.Script},
Confirmations: e.chain.BlockHeight() - hdr.Index + 1,
NextBlockHash: &nextHash,
Header: *hdr,
BlockMetadata: result.BlockMetadata{
Size: io.GetVarSize(hdr),
NextBlockHash: &nextHash,
Confirmations: e.chain.BlockHeight() - hdr.Index + 1,
},
}
rpc := fmt.Sprintf(rpc, `["`+testHeaderHash+`", 2]`)