2
2
3
3
//! Tests for methods found under the `== Wallet ==` section of the API docs.
4
4
5
- #![ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
6
-
7
5
#[ cfg( feature = "TODO" ) ]
8
6
use bitcoin:: address:: { Address , NetworkChecked } ;
9
7
use bitcoin:: Amount ;
@@ -23,6 +21,7 @@ pub fn add_multisig_address() {
23
21
assert ! ( json. into_model( ) . is_ok( ) ) ;
24
22
}
25
23
24
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
26
25
#[ test]
27
26
pub fn bump_fee ( ) {
28
27
let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
@@ -40,6 +39,7 @@ pub fn bump_fee() {
40
39
assert ! ( json. into_model( ) . is_ok( ) ) ;
41
40
}
42
41
42
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
43
43
#[ test]
44
44
pub fn create_wallet ( ) {
45
45
// Implicitly tests `createwallet` because we create the default wallet.
@@ -49,6 +49,7 @@ pub fn create_wallet() {
49
49
// optional `String` to an optional vector of strings in v25. Needs testing.
50
50
}
51
51
52
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
52
53
#[ test]
53
54
pub fn dump_priv_key ( ) {
54
55
let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
@@ -57,6 +58,7 @@ pub fn dump_priv_key() {
57
58
assert ! ( json. into_model( ) . is_ok( ) ) ;
58
59
}
59
60
61
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
60
62
#[ test]
61
63
pub fn dump_wallet ( ) {
62
64
let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
@@ -65,6 +67,7 @@ pub fn dump_wallet() {
65
67
let _ = json. into_model ( ) ;
66
68
}
67
69
70
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
68
71
#[ test]
69
72
pub fn get_addresses_by_label ( ) {
70
73
let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
@@ -76,6 +79,7 @@ pub fn get_addresses_by_label() {
76
79
assert ! ( map. get( & addr) . is_some( ) ) ;
77
80
}
78
81
82
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
79
83
#[ test]
80
84
// TODO: Consider testing a few different address types.
81
85
#[ cfg( feature = "TODO" ) ]
@@ -86,6 +90,7 @@ pub fn get_address_info() {
86
90
assert ! ( json. into_model( ) . is_ok( ) ) ;
87
91
}
88
92
93
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
89
94
#[ test]
90
95
fn get_balance ( ) {
91
96
let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
@@ -97,6 +102,7 @@ fn get_balance() {
97
102
assert ! ( json. into_model( ) . is_ok( ) ) ;
98
103
}
99
104
105
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
100
106
#[ test]
101
107
#[ cfg( feature = "v19" ) ]
102
108
fn get_balances ( ) {
@@ -108,6 +114,7 @@ fn get_balances() {
108
114
assert ! ( model. mine. trusted > Amount :: ZERO ) ;
109
115
}
110
116
117
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
111
118
#[ test]
112
119
fn get_new_address ( ) {
113
120
let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
@@ -132,13 +139,15 @@ fn get_new_address() {
132
139
. unwrap ( ) ;
133
140
}
134
141
142
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
135
143
#[ test]
136
144
fn get_raw_change_address ( ) {
137
145
let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
138
146
let json = node. client . get_raw_change_address ( ) . expect ( "getrawchangeaddress" ) ;
139
147
assert ! ( json. into_model( ) . is_ok( ) ) ;
140
148
}
141
149
150
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
142
151
#[ test]
143
152
fn get_received_by_address ( ) {
144
153
let amount = Amount :: from_sat ( 10_000 ) ;
@@ -160,6 +169,7 @@ fn get_received_by_address() {
160
169
assert_eq ! ( model. 0 , amount) ;
161
170
}
162
171
172
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
163
173
#[ test]
164
174
fn get_transaction ( ) {
165
175
let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
@@ -177,12 +187,14 @@ fn get_transaction() {
177
187
assert ! ( json. into_model( ) . is_ok( ) ) ;
178
188
}
179
189
190
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
180
191
#[ test]
181
192
fn load_wallet ( ) {
182
193
// Implicitly test loadwalled because we load the default wallet.
183
194
let _ = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
184
195
}
185
196
197
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
186
198
#[ test]
187
199
#[ cfg( not( any( feature = "v17" , feature = "v18" , feature = "v19" , feature = "v20" ) ) ) ]
188
200
fn unload_wallet ( ) {
@@ -193,6 +205,7 @@ fn unload_wallet() {
193
205
assert ! ( json. into_model( ) . is_ok( ) )
194
206
}
195
207
208
+ #[ cfg( any( feature = "0_17_1" , feature = "0_18_1" ) ) ]
196
209
#[ test]
197
210
fn send_to_address ( ) {
198
211
let node = Node :: with_wallet ( Wallet :: Default , & [ ] ) ;
0 commit comments