Fix rpc tests

This commit is contained in:
Martin Boehm 2018-08-29 21:16:23 +02:00
parent bd88ab4094
commit 06ab4fb9f8
14 changed files with 20 additions and 6 deletions

View File

@ -67,10 +67,10 @@ func LoadTestConfig(coin string) (*TestConfig, error) {
func LoadRPCConfig(coin string) (json.RawMessage, error) {
t := `{
"coin_name": "%s",
"rpcURL": "%s",
"rpcUser": "%s",
"rpcPass": "%s",
"rpcTimeout": 25,
"rpc_url": "%s",
"rpc_user": "%s",
"rpc_pass": "%s",
"rpc_timeout": 25,
"parse": true
}`

View File

@ -21,6 +21,7 @@ type TestConfig struct {
type TestData struct {
BlockHeight uint32 `json:"blockHeight"`
BlockHash string `json:"blockHash"`
BlockTime int64 `json:"blockTime"`
BlockTxs []string `json:"blockTxs"`
TxDetails map[string]*bchain.Tx `json:"txDetails"`
}
@ -432,6 +433,7 @@ func (rt *Test) TestGetBlockHeader(t *testing.T) {
want := &bchain.BlockHeader{
Hash: rt.TestData.BlockHash,
Height: rt.TestData.BlockHeight,
Time: rt.TestData.BlockTime,
}
got, err := rt.Client.GetBlockHeader(rt.TestData.BlockHash)
@ -448,6 +450,6 @@ func (rt *Test) TestGetBlockHeader(t *testing.T) {
got.Prev, got.Next = "", ""
if !reflect.DeepEqual(got, want) {
t.Errorf("GetBlockHeader() got=%v, want=%v", got, want)
t.Errorf("GetBlockHeader() got=%+v, want=%+v", got, want)
}
}

View File

@ -1,6 +1,7 @@
{
"blockHeight": 538226,
"blockHash": "0000000000000000008f48dad3a9efb25275fe36bb31b460e775af57783cc9af",
"blockTime": 1531135480,
"blockTxs": [
"77360353ff628d53534201712db7a7689a3f9318cad240fbc093dfb4778fdf84",
"82d95972a276b4197806ec0d9e3e56b66523849b2a7597ac509f4dfc8f7db4fd",

View File

@ -1,6 +1,7 @@
{
"blockHeight": 1241851,
"blockHash": "00000000ff54973b45ac277fc9e92408479703d785eae0e96508bc5aa792d621",
"blockTime": 1529571678,
"blockTxs": [
"0cbcd28da300a850fd922caf633f2aaca0fd0a2d4ce46c6f07314c644287527a",
"32fe2a3a60eb952d6ade53b7030ddb6ad8af5797391857baaad37c5b20f3b5ca"

View File

@ -1,6 +1,7 @@
{
"blockHeight": 529150,
"blockHash": "00000000000000000035835503f43c878ebb643f3b40bdfd0dfda760da74e73c",
"blockTime": 1529915213,
"blockTxs": [
"8dd1379174e262d12a32d217e87a7caf09fa1b9e48a6fe010cac219f18c6de58",
"5fce44793b328ca5f142caadbf29efc78a0059d7a6379dff81fc6447b519a7c3",

View File

@ -1,6 +1,7 @@
{
"blockHeight": 1325168,
"blockHash": "000000000000004ed0834f3de922e66d024ec4da9fcc2da17be61369cb6dc041",
"blockTime": 1528788394,
"blockTxs": [
"e1179f205aabbf48dc2ce4ebd9ed255571b0578e4de551f6574a50cb81120007",
"00a5aa2891d41af9eb1dc30c940f142a609ecab8f370eb0874ba7d32252d1b1b",

View File

@ -1,6 +1,7 @@
{
"blockHeight": 894503,
"blockHash": "0000000000000026e2b7c7bb478f0ee846dd976ac6b97c3f3f7c8c65beab88a4",
"blockTime": 1530189699,
"blockTxs": [
"6ea3a7fee4c40170d8782719d6fbeafd4cabb830f880d91bcf34811ad79e57bb",
"c269940d8e46d94ff61a4adec8aa6dfb13803723a95a5b61c7831d3aea308cbc",

View File

@ -1,7 +1,8 @@
{
"blockHeight": 139521,
"blockHash": "000000000296ea05e13b5479f6c041de575eec90759f58f57d311a8918b0af17",
"blockTxs": [
"blockTime": 1528713762,
"blockTxs": [
"cfe2d2c5bd9929349a9d8f3d8f2423f4f0c9b408ed41b3002be5e7437a20aa7d",
"3f7ac6c55c0b383feb17715aef3cebf29182039fc42577d7c517b2fc04096942",
"3f296b929f6ee4f0ad3d6fce35873d6aeacbdf06aaf2abe384beb6e3f2a4dd03",

View File

@ -1,6 +1,7 @@
{
"blockHeight": 2870000,
"blockHash": "0xeccd6b0031015a19cb7d4e10f28590ba65a6a54ad1baa322b50fe5ad16903895",
"blockTime": 1521515026,
"blockTxs": [
"0x17ee235fc0359155b25419e0e4c65d9c500df6e71e8288d6ef020d04cc2f2cb3",
"0xe6b168d6bb3d8ed78e03dbf828b6bfd1fb613f6e129cba624964984553724c5d",

View File

@ -1,6 +1,7 @@
{
"blockHeight": 1205643,
"blockHash": "60c80ce4f0a90f7b217bef8fab32ce2e499a4dc2067f4a6062048e3b940d76c6",
"blockTime": 1514835214,
"blockTxs": [
"38b4a919ab0f8b4570e1f26717740846b7994ba22f94c51d96eb32bc45c5886e",
"7f793aff2f74ca9cec6df08a7c0fcaa1ea301468459b46edbed693a871832298",

View File

@ -1,6 +1,7 @@
{
"blockHeight": 404680,
"blockHash": "920fe53b840111f7e593d93ba58dc54e043e10f8fa4a678e86a98f5cb5b29614",
"blockTime": 1530003649,
"blockTxs": [
"80b8477d10df9ece7d8dde2d30817e2855af1fb66b7a9ac860e592118ae33f5f",
"afcd8e3638b11b1ce52055474dcce78c4129e95ebee3305574acda48deea8a65",

View File

@ -1,6 +1,7 @@
{
"blockHeight": 952235,
"blockHash": "b2787dd022e3aa65b63dbf08af2c9bb4d4a362d95e3328c02743a5c8d75acb36",
"blockTime": 1529932850,
"blockTxs": [
"366eca05fa8579465d8822ad6462762120b26239201a34981e5f9d9efac3cc31",
"e74c247a5a77d4edd96a5dbb2930c74d9ab550affde991731f78f3e3a2f4b559",

View File

@ -1,6 +1,7 @@
{
"blockHeight": 349410,
"blockHash": "000000000101b45343aeda139d06d7f188393a5cf4adabfa191cb1828d67f6bd",
"blockTime": 1530264033,
"blockTxs": [
"6ebf0114454ba776f878cf726be3cb65964b21fad8dfca5d2ee69bd4a32cfa97",
"3de894528d5f8dbe14f726244be70a88f9b738020215c91b2893fa5a46f48c14",

View File

@ -1,6 +1,7 @@
{
"blockHeight": 251102,
"blockHash": "001335906f981bbf0633e124e2fa8afef3d882e34a0306a4e0c55162e57e673d",
"blockTime": 1528781777,
"blockTxs": [
"f02aa1c4c86e1d0cef6ccbbc48b2b7b38355bc3612d8f77dd58d04be1ec6ba19",
"a9f7cc34d7e272d2d9fb68cfa1c1941e338f377e6e426ae2fea1c12616d89c63",