rpc/block: rework the way Block is JSONized
Our block.Block was JSONized in a bit different fashion than result.Block in its NextConsensus and Index fields. It's not good for notifications because third-party clients would probably expect to see the same format. Also, using completely different Block representation is probably making our client a bit weaker as this representation is harder to use with other neo-go components. So use the same approach we took for Transactions and wrap block.Block which is to be serialized in proper way. Fix `Script` JSONization along the way, 3.0 node wraps it within `witnesses`.
This commit is contained in:
parent
393ce1c230
commit
7633439845
9 changed files with 296 additions and 102 deletions
|
@ -384,9 +384,8 @@ var rpcTestCases = map[string][]rpcTestCase{
|
|||
block, err := e.chain.GetBlock(e.chain.GetHeaderHash(3))
|
||||
require.NoErrorf(t, err, "could not get block")
|
||||
|
||||
assert.Equal(t, block.Hash(), res.Hash)
|
||||
for i := range res.Tx {
|
||||
tx := res.Tx[i]
|
||||
assert.Equal(t, block.Hash(), res.Hash())
|
||||
for i, tx := range res.Transactions {
|
||||
require.Equal(t, transaction.ContractType, tx.Type)
|
||||
|
||||
actualTx := block.Transactions[i]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue