44
55#![ allow( non_snake_case) ] // Test names intentionally use double underscore.
66
7- use bitcoin:: hex;
87use bitcoin:: consensus:: encode;
8+ use bitcoin:: hex;
99use integration_test:: { Node , NodeExt as _, Wallet } ;
1010use node:: client:: client_sync;
11- use node:: vtype:: * ; // All the version specific types.
12- use node:: mtype;
13- use node:: { Input , Output } ;
11+ use node:: vtype:: * ; // All the version specific types.
12+ use node:: { mtype, Input , Output } ;
1413
1514#[ test]
1615#[ cfg( not( feature = "v25_and_below" ) ) ]
@@ -50,11 +49,13 @@ fn blockchain__get_block__modelled() {
5049 let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
5150 let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
5251
53- let json: GetBlockVerboseZero = node. client . get_block_verbose_zero ( block_hash) . expect ( "getblock verbose=0" ) ;
52+ let json: GetBlockVerboseZero =
53+ node. client . get_block_verbose_zero ( block_hash) . expect ( "getblock verbose=0" ) ;
5454 let model: Result < mtype:: GetBlockVerboseZero , encode:: FromHexError > = json. into_model ( ) ;
5555 model. unwrap ( ) ;
5656
57- let json: GetBlockVerboseOne = node. client . get_block_verbose_one ( block_hash) . expect ( "getblock verbose=1" ) ;
57+ let json: GetBlockVerboseOne =
58+ node. client . get_block_verbose_one ( block_hash) . expect ( "getblock verbose=1" ) ;
5859 let model: Result < mtype:: GetBlockVerboseOne , GetBlockVerboseOneError > = json. into_model ( ) ;
5960 model. unwrap ( ) ;
6061
@@ -143,7 +144,8 @@ fn blockchain__get_block_header__modelled() {
143144 model. unwrap ( ) ;
144145
145146 // verbose = true
146- let json: GetBlockHeaderVerbose = node. client . get_block_header_verbose ( & block_hash) . expect ( "getblockheader" ) ;
147+ let json: GetBlockHeaderVerbose =
148+ node. client . get_block_header_verbose ( & block_hash) . expect ( "getblockheader" ) ;
147149 let model: Result < mtype:: GetBlockHeaderVerbose , GetBlockHeaderVerboseError > = json. into_model ( ) ;
148150 model. unwrap ( ) ;
149151}
@@ -169,7 +171,8 @@ fn getblockstats() {
169171
170172 // No need for explicit types, used explicitly in test below.
171173 let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
172- let json: GetBlockStats = node. client . get_block_stats_by_block_hash ( & block_hash) . expect ( "getblockstats" ) ;
174+ let json: GetBlockStats =
175+ node. client . get_block_stats_by_block_hash ( & block_hash) . expect ( "getblockstats" ) ;
173176 let model: Result < mtype:: GetBlockStats , GetBlockStatsError > = json. into_model ( ) ;
174177 model. unwrap ( ) ;
175178}
@@ -185,7 +188,8 @@ fn getblockstats_txindex() {
185188
186189 // Get block stats by block hash.
187190 let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
188- let json: GetBlockStats = node. client . get_block_stats_by_block_hash ( & block_hash) . expect ( "getblockstats" ) ;
191+ let json: GetBlockStats =
192+ node. client . get_block_stats_by_block_hash ( & block_hash) . expect ( "getblockstats" ) ;
189193 let model: Result < mtype:: GetBlockStats , GetBlockStatsError > = json. into_model ( ) ;
190194 model. unwrap ( ) ;
191195}
@@ -228,7 +232,8 @@ fn blockchain__get_deployment_info__modelled() {
228232 let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
229233 let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
230234
231- let json: GetDeploymentInfo = node. client . get_deployment_info ( & block_hash) . expect ( "getdeploymentinfo" ) ;
235+ let json: GetDeploymentInfo =
236+ node. client . get_deployment_info ( & block_hash) . expect ( "getdeploymentinfo" ) ;
232237 let model: Result < mtype:: GetDeploymentInfo , GetDeploymentInfoError > = json. into_model ( ) ;
233238 model. unwrap ( ) ;
234239}
@@ -238,7 +243,8 @@ fn blockchain__get_deployment_info__modelled() {
238243fn blockchain__get_descriptor_activity__modelled ( ) {
239244 let node = Node :: with_wallet ( Wallet :: None , & [ "-coinstatsindex=1" , "-txindex=1" ] ) ;
240245
241- let json: GetDescriptorActivity = node. client . get_descriptor_activity ( ) . expect ( "getdescriptoractivity" ) ;
246+ let json: GetDescriptorActivity =
247+ node. client . get_descriptor_activity ( ) . expect ( "getdescriptoractivity" ) ;
242248 let model: Result < mtype:: GetDescriptorActivity , GetDescriptorActivityError > = json. into_model ( ) ;
243249 model. unwrap ( ) ;
244250}
@@ -273,10 +279,8 @@ fn blockchain__get_mempool_ancestors_verbose__modelled() {
273279 let ( _address, parent_txid) = node. create_mempool_transaction ( ) ;
274280 let child_txid = create_child_spending_parent ( & node, parent_txid) ;
275281
276- let json: GetMempoolAncestorsVerbose = node
277- . client
278- . get_mempool_ancestors_verbose ( child_txid)
279- . expect ( "getmempoolancestors verbose" ) ;
282+ let json: GetMempoolAncestorsVerbose =
283+ node. client . get_mempool_ancestors_verbose ( child_txid) . expect ( "getmempoolancestors verbose" ) ;
280284 let model: Result < mtype:: GetMempoolAncestorsVerbose , MapMempoolEntryError > = json. into_model ( ) ;
281285 let ancestors = model. unwrap ( ) ;
282286
@@ -309,7 +313,8 @@ fn blockchain__get_mempool_descendants_verbose__modelled() {
309313 . client
310314 . get_mempool_descendants_verbose ( parent_txid)
311315 . expect ( "getmempooldescendants verbose" ) ;
312- let model: Result < mtype:: GetMempoolDescendantsVerbose , MapMempoolEntryError > = json. into_model ( ) ;
316+ let model: Result < mtype:: GetMempoolDescendantsVerbose , MapMempoolEntryError > =
317+ json. into_model ( ) ;
313318 let descendants = model. unwrap ( ) ;
314319
315320 assert ! ( descendants. 0 . contains_key( & child_txid) ) ;
@@ -406,17 +411,12 @@ fn blockchain__get_tx_spending_prevout__modelled() {
406411 let ( _address2, txid_2) = node. create_mempool_transaction ( ) ;
407412
408413 let inputs = vec ! [
409- bitcoin:: OutPoint {
410- txid: txid_1,
411- vout: 0 ,
412- } ,
413- bitcoin:: OutPoint {
414- txid: txid_2,
415- vout: 0 ,
416- } ,
414+ bitcoin:: OutPoint { txid: txid_1, vout: 0 } ,
415+ bitcoin:: OutPoint { txid: txid_2, vout: 0 } ,
417416 ] ;
418417
419- let json: GetTxSpendingPrevout = node. client . get_tx_spending_prevout ( & inputs) . expect ( "gettxspendingprevout" ) ;
418+ let json: GetTxSpendingPrevout =
419+ node. client . get_tx_spending_prevout ( & inputs) . expect ( "gettxspendingprevout" ) ;
420420 let model: Result < mtype:: GetTxSpendingPrevout , GetTxSpendingPrevoutError > = json. into_model ( ) ;
421421 let spending_prevout = model. unwrap ( ) ;
422422
@@ -454,8 +454,15 @@ fn blockchain__prune_blockchain() {
454454 let node = Node :: with_wallet ( Wallet :: Default , & [ "-prune=550" ] ) ;
455455 let address = node. client . new_address ( ) . expect ( "Failed to get new address" ) ;
456456
457- let gen_result = node. client . generate_to_address ( NBLOCKS , & address) . expect ( "generate_to_address RPC call failed" ) ;
458- assert_eq ! ( gen_result. 0 . len( ) , NBLOCKS , "generate_to_address did not return the expected number of block hashes" ) ;
457+ let gen_result = node
458+ . client
459+ . generate_to_address ( NBLOCKS , & address)
460+ . expect ( "generate_to_address RPC call failed" ) ;
461+ assert_eq ! (
462+ gen_result. 0 . len( ) ,
463+ NBLOCKS ,
464+ "generate_to_address did not return the expected number of block hashes"
465+ ) ;
459466
460467 let target_height: u64 = 500 ;
461468
@@ -487,7 +494,8 @@ fn blockchain__scan_blocks_modelled() {
487494 // Arbitrary scan descriptor
488495 let scan_desc = "pkh(022afc20bf379bc96a2f4e9e63ffceb8652b2b6a097f63fbee6ecec2a49a48010e)" ;
489496
490- let json: ScanBlocksStart = node. client . scan_blocks_start ( & [ scan_desc] ) . expect ( "scanblocks start" ) ;
497+ let json: ScanBlocksStart =
498+ node. client . scan_blocks_start ( & [ scan_desc] ) . expect ( "scanblocks start" ) ;
491499 let model: Result < mtype:: ScanBlocksStart , ScanBlocksStartError > = json. into_model ( ) ;
492500 model. unwrap ( ) ;
493501
@@ -552,7 +560,8 @@ fn create_child_spending_parent(node: &Node, parent_txid: bitcoin::Txid) -> bitc
552560 . client
553561 . sign_raw_transaction_with_wallet ( & funded_tx)
554562 . expect ( "signrawtransactionwithwallet" ) ;
555- let sign_raw_transaction = signed. into_model ( ) . expect ( "SignRawTransactionWithWallet into model" ) ;
563+ let sign_raw_transaction =
564+ signed. into_model ( ) . expect ( "SignRawTransactionWithWallet into model" ) ;
556565 let child_txid = sign_raw_transaction. tx . compute_txid ( ) ;
557566 let _ = node. client . send_raw_transaction ( & sign_raw_transaction. tx ) . expect ( "sendrawtransaction" ) ;
558567
0 commit comments