@@ -24,34 +24,28 @@ import (
24
24
25
25
// testChainKit tests ChainKit RPC endpoints.
26
26
func testChainKit (ht * lntemp.HarnessTest ) {
27
- ctx := context .Background ()
28
-
29
- // Test functions registered as test cases spin up separate nodes during
30
- // execution. By calling sub-test functions as seen below we avoid the
31
- // need to start separate nodes.
32
- testChainKitGetBlock (ctx , ht )
33
- testChainKitGetBlockHash (ctx , ht )
27
+ // Test functions registered as test cases spin up separate nodes
28
+ // during execution. By calling sub-test functions as seen below we
29
+ // avoid the need to start separate nodes.
30
+ testChainKitGetBlock (ht )
31
+ testChainKitGetBlockHash (ht )
34
32
}
35
33
36
34
// testChainKitGetBlock ensures that given a block hash, the RPC endpoint
37
35
// returns the correct target block.
38
- func testChainKitGetBlock (ctx context. Context , ht * lntemp.HarnessTest ) {
36
+ func testChainKitGetBlock (ht * lntemp.HarnessTest ) {
39
37
// Get best block hash.
40
- bestBlockRes , err := ht .Alice .RPC .ChainKit .GetBestBlock (
41
- ctx , & chainrpc.GetBestBlockRequest {},
42
- )
43
- require .NoError (ht , err )
38
+ bestBlockRes := ht .Alice .RPC .GetBestBlock (nil )
39
+
44
40
var bestBlockHash chainhash.Hash
45
- err = bestBlockHash .SetBytes (bestBlockRes .BlockHash )
41
+ err : = bestBlockHash .SetBytes (bestBlockRes .BlockHash )
46
42
require .NoError (ht , err )
47
43
48
44
// Retrieve the best block by hash.
49
- getBlockRes , err := ht .Alice .RPC .ChainKit .GetBlock (
50
- ctx , & chainrpc.GetBlockRequest {
51
- BlockHash : bestBlockHash .CloneBytes (),
52
- },
53
- )
54
- require .NoError (ht , err )
45
+ getBlockReq := & chainrpc.GetBlockRequest {
46
+ BlockHash : bestBlockHash [:],
47
+ }
48
+ getBlockRes := ht .Alice .RPC .GetBlock (getBlockReq )
55
49
56
50
// Deserialize the block which was retrieved by hash.
57
51
msgBlock := & wire.MsgBlock {}
@@ -67,20 +61,15 @@ func testChainKitGetBlock(ctx context.Context, ht *lntemp.HarnessTest) {
67
61
68
62
// testChainKitGetBlockHash ensures that given a block height, the RPC endpoint
69
63
// returns the correct target block hash.
70
- func testChainKitGetBlockHash (ctx context. Context , ht * lntemp.HarnessTest ) {
64
+ func testChainKitGetBlockHash (ht * lntemp.HarnessTest ) {
71
65
// Get best block hash.
72
- bestBlockRes , err := ht .Alice .RPC .ChainKit .GetBestBlock (
73
- ctx , & chainrpc.GetBestBlockRequest {},
74
- )
75
- require .NoError (ht , err )
66
+ bestBlockRes := ht .Alice .RPC .GetBestBlock (nil )
76
67
77
68
// Retrieve the block hash at best block height.
78
- getBlockHashRes , err := ht .Alice .RPC .ChainKit .GetBlockHash (
79
- ctx , & chainrpc.GetBlockHashRequest {
80
- BlockHeight : int64 (bestBlockRes .BlockHeight ),
81
- },
82
- )
83
- require .NoError (ht , err )
69
+ req := & chainrpc.GetBlockHashRequest {
70
+ BlockHeight : int64 (bestBlockRes .BlockHeight ),
71
+ }
72
+ getBlockHashRes := ht .Alice .RPC .GetBlockHash (req )
84
73
85
74
// Ensure best block hash is the same as retrieved block hash.
86
75
expected := bestBlockRes .BlockHash
0 commit comments