|
|
|
@ -136,17 +136,17 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
|
|
|
|
|
invoke: func(c *Client) (interface{}, error) {
|
|
|
|
|
return c.GetBlockByIndex(5)
|
|
|
|
|
},
|
|
|
|
|
serverResponse: `{"id":1,"jsonrpc":"2.0","result":"000000000c9e819ca13abd194ea86727f8dae2c28634a855836755bde0217125611aefe7675b5bd2a90a1f5e74b2e4386162240318f86534f4d3061722ba78b4fe10fe53a9d49e5e00000000050000005704000000000000d60ac443bb800fb08261e75fa5925d747d48586101fd0401407153238e784d759f1093e5911fcbb07f78af3f83a2159d59511b1c31dd4b70311feb9d63531427ac0e30dc3ae6656adda1f31713a7d56ff68a8764af523776cb4048630138d8d402902b66107ef9a50a227e1be8d8ce148f821e58f45430e59b8c034f1b5ed8208f7ce9711942405bb991d4e69232235bafa5476a8f30b92ac7e840947723eafcdfa2e9d75b551b5fc72bdb300cf541d84db5be4f2a5c33d45b0e3ae35a18c33af988c88dd201c823c15fced52eeed66d7defa3fcf7ea1587e8851c40365d8fdf714453d48f030cf3f7744b57d2cd35ad07a7980b58718e3da9e4dfe466f2e1089e8123dfc5d8d6fe679627ae78aa4cb4986cb4805d78becc009544c594534c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e4c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd624c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc24c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6995450683073b3bb010000d5040000d60ac443bb800fb08261e75fa5925d747d4858610500000000000001fd040140947358ca2dd7543c3ff3f6ea1389a72c3d5ee99f47a9d0ef70bd84a9f57384e76271efc682f6741568c55907b1794b9f520f7d35f39382303bf0206945b5009a409f467419a886aebe6b482e6d5787981d98b58b82959a2858045bf5683665a5c25c502481b2d9655c902c5dcc147546bed58175c2ed16f328cc21e999e19741554063cab34f1613932947a1c346416b12b1ca724198016acc5fd760597539eed74f2069cfe2a8383e99595aefa3234d79d64a39e3f4c64e8cea800469a6f790999c408e2438fab244bdb79e67f6dab9cde0063e523bd0c175657a66e84897cd15eec8bf358661666679bf50334664872616faa366825f36873b16dd2add64c418cd5794534c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e4c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd624c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc24c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6995450683073b3bb"}`,
|
|
|
|
|
serverResponse: `{"id":1,"jsonrpc":"2.0","result":"0000000062af8cd56d179044215cc8611f75bd96d896f1026c5b42994ae7707df8d82bd3c9f774f449fec7135b506faffaaeee603e2b82e01dec7d0f706789aa1bb983ae0ec7a25e0000000005000000e903736ceceeceae1806eee0e3ec61e7cce476ce01fd08010c408e48ace06fdd7d9bf536b6cb683f7edd336c60a707df8110f69121273fe7e0353e574c55abf2961ac4f7f2bfef44af07e6121f42e5e2115517b29060e3a7dd3e0c40d56609addaa61f06d9df159f7008ffb889d605742baaf7f95a8283469d6e5a4a76c5814f24efa0452e3c6723d88e43833e917551808d05aca8d46a17f25c72440c40fa0b66a2a41933e39685f7cbf45ba0cef286b3eed5f7d1cb60db4bac3a9c55212efb5b1f4a4c5512b2562f8e0a2ebfbc8951734ca53243ec963bd6839773f5910c40c1c0de79304d8ad7e204dceb880325694e5c34abb25ff23beb61e931ecf384e4f06c13a5ea56273c400ecac9408a3eb8e8cf3b0b358f7b2b6ac5120bb5c7763594130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb020057040000000000000000d5040000e903736ceceeceae1806eee0e3ec61e7cce476ce0500000000000001fd08010c40a9c72069ad0365a8f0787a236ec60293a9846172e9cdeaeb665586d6c72545bcfa694422f8ccd3e76bce7e27ac8099cc9b3f6322bcfeaf971c9b481a1a308a350c4048f7c2a176a7c8eb73f881aacb0a5bc52bb3b2eeeb2341031496aaadbc043dda02d8c79935ac27ecda0dc7c2561af056946e82ff1a819b56461ad32fce83ab960c4036a238579bbe505150f2ea2e4172eb83cfd614af00c1cfe36791a1eb12cb5565f37668fa09a0fcb2528fffe377c96ec9d63d18aa19a5d6c24c5c97034d1811250c4007c3826543bc03b3b6cecf48fb30ff24033c1aad7a946ac6c54e7fa90173ff3b0fe181936079fc0e7030bdde2b655ae3a7101b8a0bd85fc98de83bb72739a9ce94130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb"}`,
|
|
|
|
|
result: func(c *Client) interface{} { return &block.Block{} },
|
|
|
|
|
check: func(t *testing.T, c *Client, result interface{}) {
|
|
|
|
|
res, ok := result.(*block.Block)
|
|
|
|
|
require.True(t, ok)
|
|
|
|
|
assert.Equal(t, uint32(0), res.Version)
|
|
|
|
|
assert.Equal(t, "d745190c4823eb4d97f7a40a907f931e05380c05070bd71cb09d832d7bca4bb8", res.Hash().StringLE())
|
|
|
|
|
assert.Equal(t, "e7ef1a61257121e0bd55678355a83486c2e2daf82767a84e19bd3aa19c819e0c", res.PrevHash.StringLE())
|
|
|
|
|
assert.Equal(t, "53fe10feb478ba221706d3f43465f8180324626138e4b2745e1f0aa9d25b5b67", res.MerkleRoot.StringLE())
|
|
|
|
|
assert.Equal(t, "424b08395ea83eb09604a6c8e76e95574b657e219fe2c3e2f1574176581bf7e9", res.Hash().StringLE())
|
|
|
|
|
assert.Equal(t, "d32bd8f87d70e74a99425b6c02f196d896bd751f61c85c214490176dd58caf62", res.PrevHash.StringLE())
|
|
|
|
|
assert.Equal(t, "ae83b91baa8967700f7dec1de0822b3e60eeaefaaf6f505b13c7fe49f474f7c9", res.MerkleRoot.StringLE())
|
|
|
|
|
assert.Equal(t, 1, len(res.Transactions))
|
|
|
|
|
assert.Equal(t, "53fe10feb478ba221706d3f43465f8180324626138e4b2745e1f0aa9d25b5b67", res.Transactions[0].Hash().StringLE())
|
|
|
|
|
assert.Equal(t, "ae63e96d984673b038c83cfcb94323e37bdab29a53921823544b50df9f7edb54", res.Transactions[0].Hash().StringLE())
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -154,41 +154,41 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
|
|
|
|
|
invoke: func(c *Client) (i interface{}, err error) {
|
|
|
|
|
return c.GetBlockByIndexVerbose(5)
|
|
|
|
|
},
|
|
|
|
|
serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"hash":"0x66d1c140fbdc0eaa47e69a6a9c5034ebc3a449db98da565191ab863d1a079906","size":946,"version":0,"nextblockhash":"0xf6749a5eb21273ec67951afd22282f002e605e210678c2fa765dbecf0124bd1a","previousblockhash":"0x8fed18d4cf93e3c1607df1ffcce54a39a25c0bb18f80542ebc7a236a9204aab3","merkleroot":"0x79e5361552be86156c86c000183526f22ce0c8a0be346e692f4b388810275f26","time":1587379353,"index":5,"nonce":"0000000000000457","nextconsensus":"AZ81H31DMWzbSnFDLFkzh9vHwaDLayV7fU","confirmations":203,"script":{"invocation":"40a6cc2c7fdee4f8fd97f84114d04edda16a37a4c088da9d5be3233e118fccdf73c0305d2cbd15ea0dbcedb594fec3044844e8f59f236ded7fccb1eda2eee2c76740197eba5d648d650ca1d73b8c0a0c7cdc22d31d7b2564764729d271e7ff6378c4f2228f657d65fec530f2af6cdc7af3bc2ab17a7b8175376601fb17ec951faf074038222bb0430f7808d333be3fb8e5b93c490dbb07e6c085350ba64cb7de61127067d1825de30915964dbb345f3b902d61dbf9a294c11ff6459000648f0dc4e66740926854a25b9ea87d7fffe0253bf2bcb3d153434cc0a8ba166136d16aef9a3de70ba3704ba3103a26d01c2bdbeb7262a19bbceab6a7487beba5e55f7ee768a080","verification":"532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae"},"tx":[{"sys_fee":"0","net_fee":"0","txid":"0x79e5361552be86156c86c000183526f22ce0c8a0be346e692f4b388810275f26","size":437,"type":"MinerTransaction","version":0,"nonce":1237,"sender":"AZ81H31DMWzbSnFDLFkzh9vHwaDLayV7fU","valid_until_block":5,"attributes":[],"vin":[],"vout":[],"scripts":[{"invocation":"40f50121bb6ec9d8e0d1c15eea66b2ff7b51bb1bc4b3da27d9eac1d46b59e6a319bb1db4eb710c7f1931b0c2deaa2389a0fc3fe8c761cec40906b7973450c43173402dc082417a6815e722216de0b857eda6c846bf435088d543d2ab89f1dd92488e87b4d2c6508b0db945cbe6968e85c1c6d57274bfc898e82876c5cb08613da5d64053100f0162a41709a37305c300e7d6ac0d46575aab98dade7375b8d9ca980086594f1288dc68da0e0e42913d1c68024f63442a79c9478971d3ad93c5467ec53040a1c3a772a88b09cba8cc8ec3b46c0c0db6ac86519a7fd7db29b43d34e804a22d8839eaeb35e2a1e05d591fbad4ae290b90c6dc02dddbe28b2b3bf0fec2a337dd","verification":"532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae"}]}]}}`,
|
|
|
|
|
serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"hash":"0x424b08395ea83eb09604a6c8e76e95574b657e219fe2c3e2f1574176581bf7e9","size":977,"version":0,"nextblockhash":"0xc2ce96d861414ad229101cc9afaec4ae500f730a2180b54bd14a8dd6147bc8c3","previousblockhash":"0xd32bd8f87d70e74a99425b6c02f196d896bd751f61c85c214490176dd58caf62","merkleroot":"0xae83b91baa8967700f7dec1de0822b3e60eeaefaaf6f505b13c7fe49f474f7c9","time":1587726094,"index":5,"consensus_data":{"primary":0,"nonce":"0000000000000457"},"nextconsensus":"Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy","confirmations":203,"script":{"invocation":"0c408e48ace06fdd7d9bf536b6cb683f7edd336c60a707df8110f69121273fe7e0353e574c55abf2961ac4f7f2bfef44af07e6121f42e5e2115517b29060e3a7dd3e0c40d56609addaa61f06d9df159f7008ffb889d605742baaf7f95a8283469d6e5a4a76c5814f24efa0452e3c6723d88e43833e917551808d05aca8d46a17f25c72440c40fa0b66a2a41933e39685f7cbf45ba0cef286b3eed5f7d1cb60db4bac3a9c55212efb5b1f4a4c5512b2562f8e0a2ebfbc8951734ca53243ec963bd6839773f5910c40c1c0de79304d8ad7e204dceb880325694e5c34abb25ff23beb61e931ecf384e4f06c13a5ea56273c400ecac9408a3eb8e8cf3b0b358f7b2b6ac5120bb5c77635","verification":"130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb"},"tx":[{"sys_fee":"0","net_fee":"0","txid":"0xae63e96d984673b038c83cfcb94323e37bdab29a53921823544b50df9f7edb54","size":450,"type":"MinerTransaction","version":0,"nonce":1237,"sender":"Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy","valid_until_block":5,"attributes":[],"vin":[],"vout":[],"scripts":[{"invocation":"0c40a9c72069ad0365a8f0787a236ec60293a9846172e9cdeaeb665586d6c72545bcfa694422f8ccd3e76bce7e27ac8099cc9b3f6322bcfeaf971c9b481a1a308a350c4048f7c2a176a7c8eb73f881aacb0a5bc52bb3b2eeeb2341031496aaadbc043dda02d8c79935ac27ecda0dc7c2561af056946e82ff1a819b56461ad32fce83ab960c4036a238579bbe505150f2ea2e4172eb83cfd614af00c1cfe36791a1eb12cb5565f37668fa09a0fcb2528fffe377c96ec9d63d18aa19a5d6c24c5c97034d1811250c4007c3826543bc03b3b6cecf48fb30ff24033c1aad7a946ac6c54e7fa90173ff3b0fe181936079fc0e7030bdde2b655ae3a7101b8a0bd85fc98de83bb72739a9ce","verification":"130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb"}]}]}}`,
|
|
|
|
|
result: func(c *Client) interface{} {
|
|
|
|
|
hash, err := util.Uint256DecodeStringLE("66d1c140fbdc0eaa47e69a6a9c5034ebc3a449db98da565191ab863d1a079906")
|
|
|
|
|
hash, err := util.Uint256DecodeStringLE("424b08395ea83eb09604a6c8e76e95574b657e219fe2c3e2f1574176581bf7e9")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
nextBlockHash, err := util.Uint256DecodeStringLE("f6749a5eb21273ec67951afd22282f002e605e210678c2fa765dbecf0124bd1a")
|
|
|
|
|
nextBlockHash, err := util.Uint256DecodeStringLE("c2ce96d861414ad229101cc9afaec4ae500f730a2180b54bd14a8dd6147bc8c3")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
prevBlockHash, err := util.Uint256DecodeStringLE("8fed18d4cf93e3c1607df1ffcce54a39a25c0bb18f80542ebc7a236a9204aab3")
|
|
|
|
|
prevBlockHash, err := util.Uint256DecodeStringLE("d32bd8f87d70e74a99425b6c02f196d896bd751f61c85c214490176dd58caf62")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
merkleRoot, err := util.Uint256DecodeStringLE("79e5361552be86156c86c000183526f22ce0c8a0be346e692f4b388810275f26")
|
|
|
|
|
merkleRoot, err := util.Uint256DecodeStringLE("ae83b91baa8967700f7dec1de0822b3e60eeaefaaf6f505b13c7fe49f474f7c9")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
invScript, err := hex.DecodeString("40a6cc2c7fdee4f8fd97f84114d04edda16a37a4c088da9d5be3233e118fccdf73c0305d2cbd15ea0dbcedb594fec3044844e8f59f236ded7fccb1eda2eee2c76740197eba5d648d650ca1d73b8c0a0c7cdc22d31d7b2564764729d271e7ff6378c4f2228f657d65fec530f2af6cdc7af3bc2ab17a7b8175376601fb17ec951faf074038222bb0430f7808d333be3fb8e5b93c490dbb07e6c085350ba64cb7de61127067d1825de30915964dbb345f3b902d61dbf9a294c11ff6459000648f0dc4e66740926854a25b9ea87d7fffe0253bf2bcb3d153434cc0a8ba166136d16aef9a3de70ba3704ba3103a26d01c2bdbeb7262a19bbceab6a7487beba5e55f7ee768a080")
|
|
|
|
|
invScript, err := hex.DecodeString("0c408e48ace06fdd7d9bf536b6cb683f7edd336c60a707df8110f69121273fe7e0353e574c55abf2961ac4f7f2bfef44af07e6121f42e5e2115517b29060e3a7dd3e0c40d56609addaa61f06d9df159f7008ffb889d605742baaf7f95a8283469d6e5a4a76c5814f24efa0452e3c6723d88e43833e917551808d05aca8d46a17f25c72440c40fa0b66a2a41933e39685f7cbf45ba0cef286b3eed5f7d1cb60db4bac3a9c55212efb5b1f4a4c5512b2562f8e0a2ebfbc8951734ca53243ec963bd6839773f5910c40c1c0de79304d8ad7e204dceb880325694e5c34abb25ff23beb61e931ecf384e4f06c13a5ea56273c400ecac9408a3eb8e8cf3b0b358f7b2b6ac5120bb5c77635")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
verifScript, err := hex.DecodeString("532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae")
|
|
|
|
|
verifScript, err := hex.DecodeString("130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
sender, err := address.StringToUint160("AZ81H31DMWzbSnFDLFkzh9vHwaDLayV7fU")
|
|
|
|
|
sender, err := address.StringToUint160("Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
txInvScript, err := hex.DecodeString("40f50121bb6ec9d8e0d1c15eea66b2ff7b51bb1bc4b3da27d9eac1d46b59e6a319bb1db4eb710c7f1931b0c2deaa2389a0fc3fe8c761cec40906b7973450c43173402dc082417a6815e722216de0b857eda6c846bf435088d543d2ab89f1dd92488e87b4d2c6508b0db945cbe6968e85c1c6d57274bfc898e82876c5cb08613da5d64053100f0162a41709a37305c300e7d6ac0d46575aab98dade7375b8d9ca980086594f1288dc68da0e0e42913d1c68024f63442a79c9478971d3ad93c5467ec53040a1c3a772a88b09cba8cc8ec3b46c0c0db6ac86519a7fd7db29b43d34e804a22d8839eaeb35e2a1e05d591fbad4ae290b90c6dc02dddbe28b2b3bf0fec2a337dd")
|
|
|
|
|
txInvScript, err := hex.DecodeString("0c40a9c72069ad0365a8f0787a236ec60293a9846172e9cdeaeb665586d6c72545bcfa694422f8ccd3e76bce7e27ac8099cc9b3f6322bcfeaf971c9b481a1a308a350c4048f7c2a176a7c8eb73f881aacb0a5bc52bb3b2eeeb2341031496aaadbc043dda02d8c79935ac27ecda0dc7c2561af056946e82ff1a819b56461ad32fce83ab960c4036a238579bbe505150f2ea2e4172eb83cfd614af00c1cfe36791a1eb12cb5565f37668fa09a0fcb2528fffe377c96ec9d63d18aa19a5d6c24c5c97034d1811250c4007c3826543bc03b3b6cecf48fb30ff24033c1aad7a946ac6c54e7fa90173ff3b0fe181936079fc0e7030bdde2b655ae3a7101b8a0bd85fc98de83bb72739a9ce")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
txVerifScript, err := hex.DecodeString("532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae")
|
|
|
|
|
txVerifScript, err := hex.DecodeString("130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
@ -205,16 +205,19 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
|
|
|
|
|
_ = tx.Hash()
|
|
|
|
|
return &result.Block{
|
|
|
|
|
Hash: hash,
|
|
|
|
|
Size: 946,
|
|
|
|
|
Size: 977,
|
|
|
|
|
Version: 0,
|
|
|
|
|
NextBlockHash: &nextBlockHash,
|
|
|
|
|
PreviousBlockHash: prevBlockHash,
|
|
|
|
|
MerkleRoot: merkleRoot,
|
|
|
|
|
Time: 1587379353,
|
|
|
|
|
Time: 1587726094,
|
|
|
|
|
Index: 5,
|
|
|
|
|
Nonce: "0000000000000457",
|
|
|
|
|
NextConsensus: "AZ81H31DMWzbSnFDLFkzh9vHwaDLayV7fU",
|
|
|
|
|
NextConsensus: "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
|
|
|
|
|
Confirmations: 203,
|
|
|
|
|
ConsensusData: result.ConsensusData{
|
|
|
|
|
PrimaryIndex: 0,
|
|
|
|
|
Nonce: "0000000000000457",
|
|
|
|
|
},
|
|
|
|
|
Script: transaction.Witness{
|
|
|
|
|
InvocationScript: invScript,
|
|
|
|
|
VerificationScript: verifScript,
|
|
|
|
@ -232,69 +235,69 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
|
|
|
|
|
{
|
|
|
|
|
name: "byHash_positive",
|
|
|
|
|
invoke: func(c *Client) (interface{}, error) {
|
|
|
|
|
hash, err := util.Uint256DecodeStringLE("b84bca7b2d839db01cd70b07050c38051e937f900aa4f7974deb23480c1945d7")
|
|
|
|
|
hash, err := util.Uint256DecodeStringLE("e9f71b58764157f1e2c3e29f217e654b57956ee7c8a60496b03ea85e39084b42")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
return c.GetBlockByHash(hash)
|
|
|
|
|
},
|
|
|
|
|
serverResponse: `{"id":1,"jsonrpc":"2.0","result":"000000000c9e819ca13abd194ea86727f8dae2c28634a855836755bde0217125611aefe7675b5bd2a90a1f5e74b2e4386162240318f86534f4d3061722ba78b4fe10fe53a9d49e5e00000000050000005704000000000000d60ac443bb800fb08261e75fa5925d747d48586101fd0401407153238e784d759f1093e5911fcbb07f78af3f83a2159d59511b1c31dd4b70311feb9d63531427ac0e30dc3ae6656adda1f31713a7d56ff68a8764af523776cb4048630138d8d402902b66107ef9a50a227e1be8d8ce148f821e58f45430e59b8c034f1b5ed8208f7ce9711942405bb991d4e69232235bafa5476a8f30b92ac7e840947723eafcdfa2e9d75b551b5fc72bdb300cf541d84db5be4f2a5c33d45b0e3ae35a18c33af988c88dd201c823c15fced52eeed66d7defa3fcf7ea1587e8851c40365d8fdf714453d48f030cf3f7744b57d2cd35ad07a7980b58718e3da9e4dfe466f2e1089e8123dfc5d8d6fe679627ae78aa4cb4986cb4805d78becc009544c594534c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e4c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd624c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc24c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6995450683073b3bb010000d5040000d60ac443bb800fb08261e75fa5925d747d4858610500000000000001fd040140947358ca2dd7543c3ff3f6ea1389a72c3d5ee99f47a9d0ef70bd84a9f57384e76271efc682f6741568c55907b1794b9f520f7d35f39382303bf0206945b5009a409f467419a886aebe6b482e6d5787981d98b58b82959a2858045bf5683665a5c25c502481b2d9655c902c5dcc147546bed58175c2ed16f328cc21e999e19741554063cab34f1613932947a1c346416b12b1ca724198016acc5fd760597539eed74f2069cfe2a8383e99595aefa3234d79d64a39e3f4c64e8cea800469a6f790999c408e2438fab244bdb79e67f6dab9cde0063e523bd0c175657a66e84897cd15eec8bf358661666679bf50334664872616faa366825f36873b16dd2add64c418cd5794534c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e4c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd624c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc24c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6995450683073b3bb"}`,
|
|
|
|
|
serverResponse: `{"id":1,"jsonrpc":"2.0","result":"0000000062af8cd56d179044215cc8611f75bd96d896f1026c5b42994ae7707df8d82bd3c9f774f449fec7135b506faffaaeee603e2b82e01dec7d0f706789aa1bb983ae0ec7a25e0000000005000000e903736ceceeceae1806eee0e3ec61e7cce476ce01fd08010c408e48ace06fdd7d9bf536b6cb683f7edd336c60a707df8110f69121273fe7e0353e574c55abf2961ac4f7f2bfef44af07e6121f42e5e2115517b29060e3a7dd3e0c40d56609addaa61f06d9df159f7008ffb889d605742baaf7f95a8283469d6e5a4a76c5814f24efa0452e3c6723d88e43833e917551808d05aca8d46a17f25c72440c40fa0b66a2a41933e39685f7cbf45ba0cef286b3eed5f7d1cb60db4bac3a9c55212efb5b1f4a4c5512b2562f8e0a2ebfbc8951734ca53243ec963bd6839773f5910c40c1c0de79304d8ad7e204dceb880325694e5c34abb25ff23beb61e931ecf384e4f06c13a5ea56273c400ecac9408a3eb8e8cf3b0b358f7b2b6ac5120bb5c7763594130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb020057040000000000000000d5040000e903736ceceeceae1806eee0e3ec61e7cce476ce0500000000000001fd08010c40a9c72069ad0365a8f0787a236ec60293a9846172e9cdeaeb665586d6c72545bcfa694422f8ccd3e76bce7e27ac8099cc9b3f6322bcfeaf971c9b481a1a308a350c4048f7c2a176a7c8eb73f881aacb0a5bc52bb3b2eeeb2341031496aaadbc043dda02d8c79935ac27ecda0dc7c2561af056946e82ff1a819b56461ad32fce83ab960c4036a238579bbe505150f2ea2e4172eb83cfd614af00c1cfe36791a1eb12cb5565f37668fa09a0fcb2528fffe377c96ec9d63d18aa19a5d6c24c5c97034d1811250c4007c3826543bc03b3b6cecf48fb30ff24033c1aad7a946ac6c54e7fa90173ff3b0fe181936079fc0e7030bdde2b655ae3a7101b8a0bd85fc98de83bb72739a9ce94130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb"}`,
|
|
|
|
|
result: func(c *Client) interface{} { return &block.Block{} },
|
|
|
|
|
check: func(t *testing.T, c *Client, result interface{}) {
|
|
|
|
|
res, ok := result.(*block.Block)
|
|
|
|
|
require.True(t, ok)
|
|
|
|
|
assert.Equal(t, uint32(0), res.Version)
|
|
|
|
|
assert.Equal(t, "d745190c4823eb4d97f7a40a907f931e05380c05070bd71cb09d832d7bca4bb8", res.Hash().StringLE())
|
|
|
|
|
assert.Equal(t, "e7ef1a61257121e0bd55678355a83486c2e2daf82767a84e19bd3aa19c819e0c", res.PrevHash.StringLE())
|
|
|
|
|
assert.Equal(t, "53fe10feb478ba221706d3f43465f8180324626138e4b2745e1f0aa9d25b5b67", res.MerkleRoot.StringLE())
|
|
|
|
|
assert.Equal(t, "424b08395ea83eb09604a6c8e76e95574b657e219fe2c3e2f1574176581bf7e9", res.Hash().StringLE())
|
|
|
|
|
assert.Equal(t, "d32bd8f87d70e74a99425b6c02f196d896bd751f61c85c214490176dd58caf62", res.PrevHash.StringLE())
|
|
|
|
|
assert.Equal(t, "ae83b91baa8967700f7dec1de0822b3e60eeaefaaf6f505b13c7fe49f474f7c9", res.MerkleRoot.StringLE())
|
|
|
|
|
assert.Equal(t, 1, len(res.Transactions))
|
|
|
|
|
assert.Equal(t, "53fe10feb478ba221706d3f43465f8180324626138e4b2745e1f0aa9d25b5b67", res.Transactions[0].Hash().StringLE())
|
|
|
|
|
assert.Equal(t, "ae63e96d984673b038c83cfcb94323e37bdab29a53921823544b50df9f7edb54", res.Transactions[0].Hash().StringLE())
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "byHash_verbose_positive",
|
|
|
|
|
invoke: func(c *Client) (i interface{}, err error) {
|
|
|
|
|
hash, err := util.Uint256DecodeStringLE("0699071a3d86ab915156da98db49a4c3eb34509c6a9ae647aa0edcfb40c1d166")
|
|
|
|
|
hash, err := util.Uint256DecodeStringLE("e9f71b58764157f1e2c3e29f217e654b57956ee7c8a60496b03ea85e39084b42")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
return c.GetBlockByHashVerbose(hash)
|
|
|
|
|
},
|
|
|
|
|
serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"hash":"0x66d1c140fbdc0eaa47e69a6a9c5034ebc3a449db98da565191ab863d1a079906","size":946,"version":0,"nextblockhash":"0xf6749a5eb21273ec67951afd22282f002e605e210678c2fa765dbecf0124bd1a","previousblockhash":"0x8fed18d4cf93e3c1607df1ffcce54a39a25c0bb18f80542ebc7a236a9204aab3","merkleroot":"0x79e5361552be86156c86c000183526f22ce0c8a0be346e692f4b388810275f26","time":1587379353,"index":5,"nonce":"0000000000000457","nextconsensus":"AZ81H31DMWzbSnFDLFkzh9vHwaDLayV7fU","confirmations":203,"script":{"invocation":"40a6cc2c7fdee4f8fd97f84114d04edda16a37a4c088da9d5be3233e118fccdf73c0305d2cbd15ea0dbcedb594fec3044844e8f59f236ded7fccb1eda2eee2c76740197eba5d648d650ca1d73b8c0a0c7cdc22d31d7b2564764729d271e7ff6378c4f2228f657d65fec530f2af6cdc7af3bc2ab17a7b8175376601fb17ec951faf074038222bb0430f7808d333be3fb8e5b93c490dbb07e6c085350ba64cb7de61127067d1825de30915964dbb345f3b902d61dbf9a294c11ff6459000648f0dc4e66740926854a25b9ea87d7fffe0253bf2bcb3d153434cc0a8ba166136d16aef9a3de70ba3704ba3103a26d01c2bdbeb7262a19bbceab6a7487beba5e55f7ee768a080","verification":"532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae"},"tx":[{"sys_fee":"0","net_fee":"0","txid":"0x79e5361552be86156c86c000183526f22ce0c8a0be346e692f4b388810275f26","size":437,"type":"MinerTransaction","version":0,"nonce":1237,"sender":"AZ81H31DMWzbSnFDLFkzh9vHwaDLayV7fU","valid_until_block":5,"attributes":[],"vin":[],"vout":[],"scripts":[{"invocation":"40f50121bb6ec9d8e0d1c15eea66b2ff7b51bb1bc4b3da27d9eac1d46b59e6a319bb1db4eb710c7f1931b0c2deaa2389a0fc3fe8c761cec40906b7973450c43173402dc082417a6815e722216de0b857eda6c846bf435088d543d2ab89f1dd92488e87b4d2c6508b0db945cbe6968e85c1c6d57274bfc898e82876c5cb08613da5d64053100f0162a41709a37305c300e7d6ac0d46575aab98dade7375b8d9ca980086594f1288dc68da0e0e42913d1c68024f63442a79c9478971d3ad93c5467ec53040a1c3a772a88b09cba8cc8ec3b46c0c0db6ac86519a7fd7db29b43d34e804a22d8839eaeb35e2a1e05d591fbad4ae290b90c6dc02dddbe28b2b3bf0fec2a337dd","verification":"532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae"}]}]}}`,
|
|
|
|
|
serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"hash":"0x424b08395ea83eb09604a6c8e76e95574b657e219fe2c3e2f1574176581bf7e9","size":977,"version":0,"nextblockhash":"0xc2ce96d861414ad229101cc9afaec4ae500f730a2180b54bd14a8dd6147bc8c3","previousblockhash":"0xd32bd8f87d70e74a99425b6c02f196d896bd751f61c85c214490176dd58caf62","merkleroot":"0xae83b91baa8967700f7dec1de0822b3e60eeaefaaf6f505b13c7fe49f474f7c9","time":1587726094,"index":5,"consensus_data":{"primary":0,"nonce":"0000000000000457"},"nextconsensus":"Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy","confirmations":203,"script":{"invocation":"0c408e48ace06fdd7d9bf536b6cb683f7edd336c60a707df8110f69121273fe7e0353e574c55abf2961ac4f7f2bfef44af07e6121f42e5e2115517b29060e3a7dd3e0c40d56609addaa61f06d9df159f7008ffb889d605742baaf7f95a8283469d6e5a4a76c5814f24efa0452e3c6723d88e43833e917551808d05aca8d46a17f25c72440c40fa0b66a2a41933e39685f7cbf45ba0cef286b3eed5f7d1cb60db4bac3a9c55212efb5b1f4a4c5512b2562f8e0a2ebfbc8951734ca53243ec963bd6839773f5910c40c1c0de79304d8ad7e204dceb880325694e5c34abb25ff23beb61e931ecf384e4f06c13a5ea56273c400ecac9408a3eb8e8cf3b0b358f7b2b6ac5120bb5c77635","verification":"130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb"},"tx":[{"sys_fee":"0","net_fee":"0","txid":"0xae63e96d984673b038c83cfcb94323e37bdab29a53921823544b50df9f7edb54","size":450,"type":"MinerTransaction","version":0,"nonce":1237,"sender":"Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy","valid_until_block":5,"attributes":[],"vin":[],"vout":[],"scripts":[{"invocation":"0c40a9c72069ad0365a8f0787a236ec60293a9846172e9cdeaeb665586d6c72545bcfa694422f8ccd3e76bce7e27ac8099cc9b3f6322bcfeaf971c9b481a1a308a350c4048f7c2a176a7c8eb73f881aacb0a5bc52bb3b2eeeb2341031496aaadbc043dda02d8c79935ac27ecda0dc7c2561af056946e82ff1a819b56461ad32fce83ab960c4036a238579bbe505150f2ea2e4172eb83cfd614af00c1cfe36791a1eb12cb5565f37668fa09a0fcb2528fffe377c96ec9d63d18aa19a5d6c24c5c97034d1811250c4007c3826543bc03b3b6cecf48fb30ff24033c1aad7a946ac6c54e7fa90173ff3b0fe181936079fc0e7030bdde2b655ae3a7101b8a0bd85fc98de83bb72739a9ce","verification":"130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb"}]}]}}`,
|
|
|
|
|
result: func(c *Client) interface{} {
|
|
|
|
|
hash, err := util.Uint256DecodeStringLE("66d1c140fbdc0eaa47e69a6a9c5034ebc3a449db98da565191ab863d1a079906")
|
|
|
|
|
hash, err := util.Uint256DecodeStringLE("424b08395ea83eb09604a6c8e76e95574b657e219fe2c3e2f1574176581bf7e9")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
nextBlockHash, err := util.Uint256DecodeStringLE("f6749a5eb21273ec67951afd22282f002e605e210678c2fa765dbecf0124bd1a")
|
|
|
|
|
nextBlockHash, err := util.Uint256DecodeStringLE("c2ce96d861414ad229101cc9afaec4ae500f730a2180b54bd14a8dd6147bc8c3")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
prevBlockHash, err := util.Uint256DecodeStringLE("8fed18d4cf93e3c1607df1ffcce54a39a25c0bb18f80542ebc7a236a9204aab3")
|
|
|
|
|
prevBlockHash, err := util.Uint256DecodeStringLE("d32bd8f87d70e74a99425b6c02f196d896bd751f61c85c214490176dd58caf62")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
merkleRoot, err := util.Uint256DecodeStringLE("79e5361552be86156c86c000183526f22ce0c8a0be346e692f4b388810275f26")
|
|
|
|
|
merkleRoot, err := util.Uint256DecodeStringLE("ae83b91baa8967700f7dec1de0822b3e60eeaefaaf6f505b13c7fe49f474f7c9")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
invScript, err := hex.DecodeString("40a6cc2c7fdee4f8fd97f84114d04edda16a37a4c088da9d5be3233e118fccdf73c0305d2cbd15ea0dbcedb594fec3044844e8f59f236ded7fccb1eda2eee2c76740197eba5d648d650ca1d73b8c0a0c7cdc22d31d7b2564764729d271e7ff6378c4f2228f657d65fec530f2af6cdc7af3bc2ab17a7b8175376601fb17ec951faf074038222bb0430f7808d333be3fb8e5b93c490dbb07e6c085350ba64cb7de61127067d1825de30915964dbb345f3b902d61dbf9a294c11ff6459000648f0dc4e66740926854a25b9ea87d7fffe0253bf2bcb3d153434cc0a8ba166136d16aef9a3de70ba3704ba3103a26d01c2bdbeb7262a19bbceab6a7487beba5e55f7ee768a080")
|
|
|
|
|
invScript, err := hex.DecodeString("0c408e48ace06fdd7d9bf536b6cb683f7edd336c60a707df8110f69121273fe7e0353e574c55abf2961ac4f7f2bfef44af07e6121f42e5e2115517b29060e3a7dd3e0c40d56609addaa61f06d9df159f7008ffb889d605742baaf7f95a8283469d6e5a4a76c5814f24efa0452e3c6723d88e43833e917551808d05aca8d46a17f25c72440c40fa0b66a2a41933e39685f7cbf45ba0cef286b3eed5f7d1cb60db4bac3a9c55212efb5b1f4a4c5512b2562f8e0a2ebfbc8951734ca53243ec963bd6839773f5910c40c1c0de79304d8ad7e204dceb880325694e5c34abb25ff23beb61e931ecf384e4f06c13a5ea56273c400ecac9408a3eb8e8cf3b0b358f7b2b6ac5120bb5c77635")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
verifScript, err := hex.DecodeString("532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae")
|
|
|
|
|
verifScript, err := hex.DecodeString("130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
sender, err := address.StringToUint160("AZ81H31DMWzbSnFDLFkzh9vHwaDLayV7fU")
|
|
|
|
|
sender, err := address.StringToUint160("Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
txInvScript, err := hex.DecodeString("40f50121bb6ec9d8e0d1c15eea66b2ff7b51bb1bc4b3da27d9eac1d46b59e6a319bb1db4eb710c7f1931b0c2deaa2389a0fc3fe8c761cec40906b7973450c43173402dc082417a6815e722216de0b857eda6c846bf435088d543d2ab89f1dd92488e87b4d2c6508b0db945cbe6968e85c1c6d57274bfc898e82876c5cb08613da5d64053100f0162a41709a37305c300e7d6ac0d46575aab98dade7375b8d9ca980086594f1288dc68da0e0e42913d1c68024f63442a79c9478971d3ad93c5467ec53040a1c3a772a88b09cba8cc8ec3b46c0c0db6ac86519a7fd7db29b43d34e804a22d8839eaeb35e2a1e05d591fbad4ae290b90c6dc02dddbe28b2b3bf0fec2a337dd")
|
|
|
|
|
txInvScript, err := hex.DecodeString("0c40a9c72069ad0365a8f0787a236ec60293a9846172e9cdeaeb665586d6c72545bcfa694422f8ccd3e76bce7e27ac8099cc9b3f6322bcfeaf971c9b481a1a308a350c4048f7c2a176a7c8eb73f881aacb0a5bc52bb3b2eeeb2341031496aaadbc043dda02d8c79935ac27ecda0dc7c2561af056946e82ff1a819b56461ad32fce83ab960c4036a238579bbe505150f2ea2e4172eb83cfd614af00c1cfe36791a1eb12cb5565f37668fa09a0fcb2528fffe377c96ec9d63d18aa19a5d6c24c5c97034d1811250c4007c3826543bc03b3b6cecf48fb30ff24033c1aad7a946ac6c54e7fa90173ff3b0fe181936079fc0e7030bdde2b655ae3a7101b8a0bd85fc98de83bb72739a9ce")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
txVerifScript, err := hex.DecodeString("532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae")
|
|
|
|
|
txVerifScript, err := hex.DecodeString("130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
@ -311,16 +314,19 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
|
|
|
|
|
_ = tx.Hash()
|
|
|
|
|
return &result.Block{
|
|
|
|
|
Hash: hash,
|
|
|
|
|
Size: 946,
|
|
|
|
|
Size: 977,
|
|
|
|
|
Version: 0,
|
|
|
|
|
NextBlockHash: &nextBlockHash,
|
|
|
|
|
PreviousBlockHash: prevBlockHash,
|
|
|
|
|
MerkleRoot: merkleRoot,
|
|
|
|
|
Time: 1587379353,
|
|
|
|
|
Time: 1587726094,
|
|
|
|
|
Index: 5,
|
|
|
|
|
Nonce: "0000000000000457",
|
|
|
|
|
NextConsensus: "AZ81H31DMWzbSnFDLFkzh9vHwaDLayV7fU",
|
|
|
|
|
NextConsensus: "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
|
|
|
|
|
Confirmations: 203,
|
|
|
|
|
ConsensusData: result.ConsensusData{
|
|
|
|
|
PrimaryIndex: 0,
|
|
|
|
|
Nonce: "0000000000000457",
|
|
|
|
|
},
|
|
|
|
|
Script: transaction.Witness{
|
|
|
|
|
InvocationScript: invScript,
|
|
|
|
|
VerificationScript: verifScript,
|
|
|
|
@ -368,21 +374,21 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
|
|
|
|
|
{
|
|
|
|
|
name: "positive",
|
|
|
|
|
invoke: func(c *Client) (interface{}, error) {
|
|
|
|
|
hash, err := util.Uint256DecodeStringLE("cac0ebfcf1230d0cd236f333dc659b232da612e7ee42bd80f9e6c8d0ce2fb542")
|
|
|
|
|
hash, err := util.Uint256DecodeStringLE("68e4bd688b852e807eef13a0ff7da7b02223e359a35153667e88f9cb4a3b0801")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
return c.GetBlockHeader(hash)
|
|
|
|
|
},
|
|
|
|
|
serverResponse: `{"id":1,"jsonrpc":"2.0","result":"0000000098166844503a270bf532addc3db1a30e22b5336594ed8944fceaaf8fe697013414aa46a5e3e62056c842d54ea5ba480fc448c498989f505bcae9ae4364436b9da5d49e5e00000000010000005704000000000000d60ac443bb800fb08261e75fa5925d747d48586101fd040140519e5dfec4f07533853ca092139070fb6f033f8ab03b226948ee35910767a2ec426ad16d70e6aaf6e70ba256c829c963efc61b450690f9f4c022ec345f4b698240527d91d454a488419f724f51f44b33f162a4c8dfe84775e3e178abe254c728fda5a81915b3fbd9d41c0609f3cd576ba65b767753b2d52e4f96ce1a9b1cdb1e364021d2d03a1b57ab5bb50ac19679f9543f10c8873ef9a8d4c236f9e022c0a60f684b78bf56bd2b5f82d0a8ed091cadd2f29a16a7e9f48f3feb723dcb7f26470f5e40f447d13062ab7ec4669b82d0da2d4e0165756b30c5f6b734cb2049d91ae0f8ab85ab52f476d825ea12f26cfaf6c8d6c662bb7e3442130785b2d12e3398ac204f94534c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e4c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd624c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc24c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6995450683073b3bb00"}`,
|
|
|
|
|
serverResponse: `{"id":1,"jsonrpc":"2.0","result":"00000000d039da5e49d63eb0533437d24ff8ceb6aeacf88680599c39f0ffca8948dfcdb94a3def1fca91cf45d69358414e3be77f7621e557f4cebbdb79a47d3cf56ac007f920a05e0000000001000000d60ac443bb800fb08261e75fa5925d747d48586101fd04014055041db6a59c99ab98137cc57e1e56a0a89856a311b2d2fc0aec76ec714c7616edc8fc5c9b81b27f25b7db1a61f64be0730a9cc103efcea1195cc3fe55843e264027e49c647f48bb08d3c32b79ee3432005ea577d7e497f78b46f1e81858848f961b557fb42a92e8eb4433fed203c917cbebb2138a31ed86750fb769d1e70956c0404c20054aa8bd45b520cba9410a9dd6c256481066bb657d7793fbba5551898c91b6dde81285fac841753ccfdd3193d08f19d5431313fa0d926ca965072a5fa3384026b0705078409bcc62fb98bb985edc387edeaaeba37bb7642d88a90762b2c2a62d9b61d53c097d548a368e450c4d995a178d5af28d4c93698233c52de05e3f0094534c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e4c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd624c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc24c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6995450683073b3bb00"}`,
|
|
|
|
|
result: func(c *Client) interface{} { return &block.Header{} },
|
|
|
|
|
check: func(t *testing.T, c *Client, result interface{}) {
|
|
|
|
|
res, ok := result.(*block.Header)
|
|
|
|
|
require.True(t, ok)
|
|
|
|
|
assert.Equal(t, uint32(0), res.Version)
|
|
|
|
|
assert.Equal(t, "cac0ebfcf1230d0cd236f333dc659b232da612e7ee42bd80f9e6c8d0ce2fb542", res.Hash().StringLE())
|
|
|
|
|
assert.Equal(t, "340197e68fafeafc4489ed946533b5220ea3b13ddcad32f50b273a5044681698", res.PrevHash.StringLE())
|
|
|
|
|
assert.Equal(t, "9d6b436443aee9ca5b509f9898c448c40f48baa54ed542c85620e6e3a546aa14", res.MerkleRoot.StringLE())
|
|
|
|
|
assert.Equal(t, "68e4bd688b852e807eef13a0ff7da7b02223e359a35153667e88f9cb4a3b0801", res.Hash().StringLE())
|
|
|
|
|
assert.Equal(t, "b9cddf4889cafff0399c598086f8acaeb6cef84fd2373453b03ed6495eda39d0", res.PrevHash.StringLE())
|
|
|
|
|
assert.Equal(t, "07c06af53c7da479dbbbcef457e521767fe73b4e415893d645cf91ca1fef3d4a", res.MerkleRoot.StringLE())
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -429,7 +435,6 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
|
|
|
|
|
MerkleRoot: merkleRoot,
|
|
|
|
|
Timestamp: 1541215200,
|
|
|
|
|
Index: 1,
|
|
|
|
|
Nonce: "51b484a2fe49ed4d",
|
|
|
|
|
NextConsensus: "AZ81H31DMWzbSnFDLFkzh9vHwaDLayV7fU",
|
|
|
|
|
Confirmations: 20061,
|
|
|
|
|
Script: transaction.Witness{
|
|
|
|
|