2
2
3
3
//! Tests for methods found under the `== Blockchain ==` section of the API docs.
4
4
5
- use integration_test:: { Node , NodeExt as _} ;
5
+ use integration_test:: { Node , NodeExt as _, Wallet } ;
6
6
7
7
#[ test]
8
8
fn get_blockchain_info ( ) {
9
- let node = Node :: new_no_wallet ( ) ;
9
+ let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
10
10
let json = node. client . get_blockchain_info ( ) . expect ( "getblockchaininfo" ) ;
11
11
assert ! ( json. into_model( ) . is_ok( ) ) ;
12
12
}
13
13
14
14
#[ test]
15
15
fn get_best_block_hash ( ) {
16
- let node = Node :: new_no_wallet ( ) ;
16
+ let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
17
17
let json = node. client . get_best_block_hash ( ) . expect ( "getbestblockhash" ) ;
18
18
assert ! ( json. into_model( ) . is_ok( ) ) ;
19
19
}
20
20
21
21
#[ test]
22
22
fn get_block ( ) {
23
- let node = Node :: new_no_wallet ( ) ;
23
+ let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
24
24
let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
25
25
26
26
let json = node. client . get_block_verbose_zero ( block_hash) . expect ( "getblock verbose=0" ) ;
@@ -36,29 +36,29 @@ fn get_block() {
36
36
37
37
#[ test]
38
38
fn get_block_count ( ) {
39
- let node = Node :: new_no_wallet ( ) ;
39
+ let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
40
40
let json = node. client . get_block_count ( ) . expect ( "getblockcount" ) ;
41
41
let _ = json. into_model ( ) ;
42
42
}
43
43
44
44
#[ test]
45
45
fn get_block_hash ( ) {
46
- let node = Node :: new_no_wallet ( ) ;
46
+ let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
47
47
let json = node. client . get_block_hash ( 0 ) . expect ( "getblockhash" ) ;
48
48
assert ! ( json. into_model( ) . is_ok( ) ) ;
49
49
}
50
50
51
51
#[ test]
52
52
fn get_block_header ( ) { // verbose = false
53
- let node = Node :: new_no_wallet ( ) ;
53
+ let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
54
54
let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
55
55
let json = node. client . get_block_header ( & block_hash) . expect ( "getblockheader" ) ;
56
56
assert ! ( json. into_model( ) . is_ok( ) ) ;
57
57
}
58
58
59
59
#[ test]
60
60
fn get_block_header_verbose ( ) { // verbose = true
61
- let node = Node :: new_no_wallet ( ) ;
61
+ let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
62
62
let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
63
63
let json = node. client . get_block_header_verbose ( & block_hash) . expect ( "getblockheader" ) ;
64
64
assert ! ( json. into_model( ) . is_ok( ) ) ;
@@ -75,7 +75,7 @@ fn get_block_stats() {
75
75
}
76
76
77
77
fn getblockstats ( ) {
78
- let node = Node :: new_with_default_wallet ( ) ;
78
+ let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
79
79
node. fund_wallet ( ) ;
80
80
81
81
let json = node. client . get_block_stats_by_height ( 1 ) . expect ( "getblockstats" ) ;
@@ -87,7 +87,7 @@ fn getblockstats() {
87
87
}
88
88
89
89
fn getblockstats_txindex ( ) {
90
- let node = Node :: new_with_default_wallet_txindex ( ) ;
90
+ let node = Node :: with_wallet ( Wallet :: Default , & [ "-txindex" ] ) ;
91
91
node. fund_wallet ( ) ;
92
92
93
93
let json = node. client . get_block_stats_by_height ( 101 ) . expect ( "getblockstats" ) ;
@@ -100,21 +100,21 @@ fn getblockstats_txindex() {
100
100
101
101
#[ test]
102
102
fn get_chain_tips ( ) {
103
- let node = Node :: new_no_wallet ( ) ;
103
+ let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
104
104
let json = node. client . get_chain_tips ( ) . expect ( "getchaintips" ) ;
105
105
assert ! ( json. into_model( ) . is_ok( ) ) ;
106
106
}
107
107
108
108
#[ test]
109
109
fn get_chain_tx_stats ( ) {
110
- let node = Node :: new_no_wallet ( ) ;
110
+ let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
111
111
let json = node. client . get_chain_tx_stats ( ) . expect ( "getchaintxstats" ) ;
112
112
assert ! ( json. into_model( ) . is_ok( ) ) ;
113
113
}
114
114
115
115
#[ test]
116
116
fn get_difficulty ( ) {
117
- let node = Node :: new_no_wallet ( ) ;
117
+ let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
118
118
let json = node. client . get_difficulty ( ) . expect ( "getdifficulty" ) ;
119
119
let _ = json. into_model ( ) ;
120
120
}
@@ -135,7 +135,7 @@ fn get_mempool_descendants() {
135
135
136
136
#[ test]
137
137
fn get_mempool_entry ( ) {
138
- let node = Node :: new_with_default_wallet ( ) ;
138
+ let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
139
139
node. fund_wallet ( ) ;
140
140
let ( _address, txid) = node. create_mempool_transaction ( ) ;
141
141
@@ -145,7 +145,7 @@ fn get_mempool_entry() {
145
145
146
146
#[ test]
147
147
fn get_mempool_info ( ) {
148
- let node = Node :: new_with_default_wallet ( ) ;
148
+ let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
149
149
node. fund_wallet ( ) ;
150
150
let ( _address, _txid) = node. create_mempool_transaction ( ) ;
151
151
@@ -158,7 +158,7 @@ fn get_mempool_info() {
158
158
159
159
#[ test]
160
160
fn get_raw_mempool ( ) {
161
- let node = Node :: new_with_default_wallet ( ) ;
161
+ let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
162
162
node. fund_wallet ( ) ;
163
163
let ( _address, _txid) = node. create_mempool_transaction ( ) ;
164
164
@@ -173,7 +173,7 @@ fn get_raw_mempool() {
173
173
// FIXME: Fails with getrawmempool verbose: JsonRpc(Json(Error("invalid type: map, expected a sequence", line: 1, column: 0)))
174
174
#[ cfg( feature = "TODO" ) ]
175
175
fn get_raw_mempool_verbose ( ) {
176
- let node = Node :: new_with_default_wallet ( ) ;
176
+ let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
177
177
node. fund_wallet ( ) ;
178
178
let ( _address, _txid) = node. create_mempool_transaction ( ) ;
179
179
@@ -186,7 +186,7 @@ fn get_raw_mempool_verbose() {
186
186
187
187
#[ test]
188
188
fn get_tx_out ( ) {
189
- let node = Node :: new_with_default_wallet ( ) ;
189
+ let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
190
190
node. fund_wallet ( ) ;
191
191
let ( _address, tx) = node. create_mined_transaction ( ) ;
192
192
let txid = tx. compute_txid ( ) ;
@@ -198,7 +198,7 @@ fn get_tx_out() {
198
198
199
199
#[ test]
200
200
fn get_tx_out_proof ( ) {
201
- let node = Node :: new_with_default_wallet ( ) ;
201
+ let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
202
202
node. fund_wallet ( ) ;
203
203
let ( _address, tx) = node. create_mined_transaction ( ) ;
204
204
let txid = tx. compute_txid ( ) ;
@@ -208,19 +208,18 @@ fn get_tx_out_proof() {
208
208
209
209
#[ test]
210
210
fn get_tx_out_set_info ( ) {
211
- let node = Node :: new_with_default_wallet ( ) ;
211
+ let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
212
212
node. fund_wallet ( ) ;
213
213
let ( _address, _tx) = node. create_mined_transaction ( ) ;
214
214
215
215
// Test the type and into model conversion code.
216
216
let json = node. client . get_tx_out_set_info ( ) . expect ( "gettxoutsetinfo" ) ;
217
217
let _ = json. into_model ( ) . expect ( "into_model" ) ;
218
-
219
218
}
220
219
221
220
#[ test]
222
221
fn precious_block ( ) {
223
- let node = Node :: new_with_default_wallet ( ) ;
222
+ let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
224
223
node. mine_a_block ( ) ;
225
224
let hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
226
225
node. mine_a_block ( ) ;
@@ -231,7 +230,7 @@ fn precious_block() {
231
230
// Implicitly tests the omitted method `gettxoutproof` as well.
232
231
#[ test]
233
232
fn verify_tx_out_proof ( ) {
234
- let node = Node :: new_with_default_wallet ( ) ;
233
+ let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
235
234
node. fund_wallet ( ) ;
236
235
let ( _address, tx) = node. create_mined_transaction ( ) ;
237
236
let txid = tx. compute_txid ( ) ;
0 commit comments