mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 23:25:22 +00:00
rpc: fixed getblockheader tests
This commit is contained in:
parent
fbdc60b731
commit
5cfa1bc2a8
1 changed files with 14 additions and 8 deletions
|
@ -405,26 +405,32 @@ var rpcTestCases = map[string][]rpcTestCase{
|
|||
"getblockheader": {
|
||||
{
|
||||
name: "positive, no verbose",
|
||||
params: `["a6e526375a780335112299f2262501e5e9574c3ba61b16bbc1e282b344f6c14d"]`,
|
||||
params: `["77259b951c7eef05fdd91f155c90c698894968c2eafc36c9ef62d6538597ba2d"]`,
|
||||
result: func(e *executor) interface{} {
|
||||
expected := "00000000b32b4a122730deb7f862bdc99b45cc8ef12ae55a8096a344429968702091bf3a8e9f458e580420a99a67f0d4137266f76523ea618d1db7ec314b106eb6e67c1721bd575e340000005704000000000000be48d3a3f5d10013ab9ffee489706078714f1ea201fd04014092cb08b7fbef9b8fe47e7d7ec0557e32aeb2e61bdf5c1c6cac203ed12ad32d50629af1783436e585acc8581f46b2b29247f04102d66e9e7e112ae5444c46487340896a200e806f4597df05a12f91f0fbc5c256522687547e7e057b88ec14082213ce98a88f6fd312d3e3fad4b77db1fcc95af69282d887d56f461280df557e4820402903ff86e02559a58376da45d27eb24e5362f6fd922b79a55c9927e33a81265b5ccfef9db83a48b3597e9b576999fc5c0f02df982dbf871a1ef60b089ffb4dae40405d746c546d0ac3d7e36f61d71996f104884db93cca7499f687eb8b8e444327f97bfb05e49ee388d36e0dc73132a3a9ec24a6d8c8b27ae92223dbb7b06af1ec8b532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae00"
|
||||
expected := "00000000c0c89580103dfc9e65777591b57aa64af3a499c62c9287329855a2398652ae60edb908054ac1409be5f77d5369c6e03490b2f6676d68d0b3370f8159e0fdadf90815615e050000005704000000000000be48d3a3f5d10013ab9ffee489706078714f1ea201fd040140dd8367b66a733fd9ab90dfdf3a64f7393d68b69e69ad7f2c89fe9bb1633de2f53a329b56a68fc47284e172e3196b63da510d5d719e9484a5da2e0732d4e85d89406d701e53f89a2037c5247663d1aa81d19899b8212c0b1052c399df11cb2909c62e1367edeb24c990df566f16218de252b87fd664fb07a157138a89fd92df45854013d5a17988a32ef9a766fb3277a7d2466c6e1608e28a3b3102a95450003a70ac63fe406742d8eed96301c51f8eb8f60b0fe77805b1ae2d508ca73897ac7a162b40640c35a3e40415a4e604ebacc3ffd96dda2e6f55589a7e87cf04280cf412c9eff49e0858d001bad2473e0de8fd9ba53c0d1718aafc6b8c3fa4d13451875e01388b532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae00"
|
||||
return &expected
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "positive, verbose 0",
|
||||
params: `["a6e526375a780335112299f2262501e5e9574c3ba61b16bbc1e282b344f6c14d", 0]`,
|
||||
params: `["77259b951c7eef05fdd91f155c90c698894968c2eafc36c9ef62d6538597ba2d", 0]`,
|
||||
result: func(e *executor) interface{} {
|
||||
expected := "00000000b32b4a122730deb7f862bdc99b45cc8ef12ae55a8096a344429968702091bf3a8e9f458e580420a99a67f0d4137266f76523ea618d1db7ec314b106eb6e67c1721bd575e340000005704000000000000be48d3a3f5d10013ab9ffee489706078714f1ea201fd04014092cb08b7fbef9b8fe47e7d7ec0557e32aeb2e61bdf5c1c6cac203ed12ad32d50629af1783436e585acc8581f46b2b29247f04102d66e9e7e112ae5444c46487340896a200e806f4597df05a12f91f0fbc5c256522687547e7e057b88ec14082213ce98a88f6fd312d3e3fad4b77db1fcc95af69282d887d56f461280df557e4820402903ff86e02559a58376da45d27eb24e5362f6fd922b79a55c9927e33a81265b5ccfef9db83a48b3597e9b576999fc5c0f02df982dbf871a1ef60b089ffb4dae40405d746c546d0ac3d7e36f61d71996f104884db93cca7499f687eb8b8e444327f97bfb05e49ee388d36e0dc73132a3a9ec24a6d8c8b27ae92223dbb7b06af1ec8b532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae00"
|
||||
expected := "00000000c0c89580103dfc9e65777591b57aa64af3a499c62c9287329855a2398652ae60edb908054ac1409be5f77d5369c6e03490b2f6676d68d0b3370f8159e0fdadf90815615e050000005704000000000000be48d3a3f5d10013ab9ffee489706078714f1ea201fd040140dd8367b66a733fd9ab90dfdf3a64f7393d68b69e69ad7f2c89fe9bb1633de2f53a329b56a68fc47284e172e3196b63da510d5d719e9484a5da2e0732d4e85d89406d701e53f89a2037c5247663d1aa81d19899b8212c0b1052c399df11cb2909c62e1367edeb24c990df566f16218de252b87fd664fb07a157138a89fd92df45854013d5a17988a32ef9a766fb3277a7d2466c6e1608e28a3b3102a95450003a70ac63fe406742d8eed96301c51f8eb8f60b0fe77805b1ae2d508ca73897ac7a162b40640c35a3e40415a4e604ebacc3ffd96dda2e6f55589a7e87cf04280cf412c9eff49e0858d001bad2473e0de8fd9ba53c0d1718aafc6b8c3fa4d13451875e01388b532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae00"
|
||||
return &expected
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "positive, verbose !=0",
|
||||
params: `["a6e526375a780335112299f2262501e5e9574c3ba61b16bbc1e282b344f6c14d", 2]`,
|
||||
params: `["77259b951c7eef05fdd91f155c90c698894968c2eafc36c9ef62d6538597ba2d", 2]`,
|
||||
result: func(e *executor) interface{} {
|
||||
hash, _ := util.Uint256DecodeStringLE("a6e526375a780335112299f2262501e5e9574c3ba61b16bbc1e282b344f6c14d")
|
||||
block, _ := e.chain.GetBlock(hash)
|
||||
hash, err := util.Uint256DecodeStringLE("77259b951c7eef05fdd91f155c90c698894968c2eafc36c9ef62d6538597ba2d")
|
||||
if err != nil {
|
||||
panic("can not decode hash parameter")
|
||||
}
|
||||
block, err := e.chain.GetBlock(hash)
|
||||
if err != nil {
|
||||
panic("unknown block (update block hash)")
|
||||
}
|
||||
header := block.Header()
|
||||
expected := result.Header{
|
||||
Hash: header.Hash(),
|
||||
|
@ -449,7 +455,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
|||
},
|
||||
{
|
||||
name: "invalid verbose type",
|
||||
params: `["a6e526375a780335112299f2262501e5e9574c3ba61b16bbc1e282b344f6c14d", true]`,
|
||||
params: `["77259b951c7eef05fdd91f155c90c698894968c2eafc36c9ef62d6538597ba2d", true]`,
|
||||
fail: true,
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue