4
4
5
5
use integration_test:: { Node , NodeExt as _} ;
6
6
7
- // FIXME: Do we need this?
8
- fn best_block_hash ( ) -> bitcoin:: BlockHash {
9
- let node = Node :: new_no_wallet ( ) ;
10
- node. client . best_block_hash ( ) . expect ( "best_block_hash failed" )
11
- }
12
-
13
7
#[ test]
14
8
fn get_blockchain_info ( ) {
15
9
let node = Node :: new_no_wallet ( ) ;
@@ -27,7 +21,7 @@ fn get_best_block_hash() {
27
21
#[ test]
28
22
fn get_block ( ) {
29
23
let node = Node :: new_no_wallet ( ) ;
30
- let block_hash = best_block_hash ( ) ;
24
+ let block_hash = node . client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
31
25
32
26
let json = node. client . get_block_verbose_zero ( block_hash) . expect ( "getblock verbose=0" ) ;
33
27
assert ! ( json. into_model( ) . is_ok( ) ) ;
@@ -57,15 +51,15 @@ fn get_block_hash() {
57
51
#[ test]
58
52
fn get_block_header ( ) { // verbose = false
59
53
let node = Node :: new_no_wallet ( ) ;
60
- let block_hash = best_block_hash ( ) ;
54
+ let block_hash = node . client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
61
55
let json = node. client . get_block_header ( & block_hash) . expect ( "getblockheader" ) ;
62
56
assert ! ( json. into_model( ) . is_ok( ) ) ;
63
57
}
64
58
65
59
#[ test]
66
60
fn get_block_header_verbose ( ) { // verbose = true
67
61
let node = Node :: new_no_wallet ( ) ;
68
- let block_hash = best_block_hash ( ) ;
62
+ let block_hash = node . client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
69
63
let json = node. client . get_block_header_verbose ( & block_hash) . expect ( "getblockheader" ) ;
70
64
assert ! ( json. into_model( ) . is_ok( ) ) ;
71
65
}
@@ -92,7 +86,7 @@ fn getblockstats() {
92
86
let json = node. client . get_block_stats_by_height ( 1 ) . expect ( "getblockstats" ) ;
93
87
assert ! ( json. into_model( ) . is_ok( ) ) ;
94
88
95
- let block_hash = best_block_hash ( ) ;
89
+ let block_hash = node . client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
96
90
let json = node. client . get_block_stats_by_block_hash ( & block_hash) . expect ( "getblockstats" ) ;
97
91
assert ! ( json. into_model( ) . is_ok( ) ) ;
98
92
}
@@ -105,7 +99,7 @@ fn getblockstats_txindex() {
105
99
let json = node. client . get_block_stats_by_height ( 1 ) . expect ( "getblockstats" ) ;
106
100
assert ! ( json. into_model( ) . is_ok( ) ) ;
107
101
108
- let block_hash = best_block_hash ( ) ;
102
+ let block_hash = node . client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
109
103
let json = node. client . get_block_stats_by_block_hash ( & block_hash) . expect ( "getblockstats" ) ;
110
104
assert ! ( json. into_model( ) . is_ok( ) ) ;
111
105
}
@@ -234,7 +228,7 @@ fn get_tx_out_set_info() {
234
228
fn precious_block ( ) {
235
229
let node = Node :: new_with_default_wallet ( ) ;
236
230
node. mine_a_block ( ) ;
237
- let hash = node. client . best_block_hash ( ) . expect ( "bestblockhash " ) ;
231
+ let hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed " ) ;
238
232
node. mine_a_block ( ) ;
239
233
240
234
let _ = node. client . precious_block ( hash) . expect ( "preciousblock" ) ;
0 commit comments