55#![ allow( non_snake_case) ] // Test names intentionally use double underscore.
66
77use bitcoin:: consensus:: encode;
8+ #[ allow( unused_imports) ] // Because of feature gated tests.
9+ use bitcoin:: ext:: * ;
810use bitcoin:: hex;
911use integration_test:: { Node , NodeExt as _, Wallet } ;
1012use node:: vtype:: * ; // All the version specific types.
@@ -39,7 +41,8 @@ fn blockchain__get_best_block_hash__modelled() {
3941 let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
4042
4143 let json: GetBestBlockHash = node. client . get_best_block_hash ( ) . expect ( "getbestblockhash" ) ;
42- let model: Result < mtype:: GetBestBlockHash , hex:: HexToArrayError > = json. into_model ( ) ;
44+ let model: Result < mtype:: GetBestBlockHash , hex:: DecodeFixedLengthBytesError > =
45+ json. into_model ( ) ;
4346 model. unwrap ( ) ;
4447}
4548
@@ -79,8 +82,8 @@ fn blockchain__get_block__modelled() {
7982 . find ( |entry| entry. transaction . transaction . compute_txid ( ) == mined_txid)
8083 . expect ( "mined transaction should be present in verbosity=2 results" ) ;
8184 assert ! ( mined_entry. fee. is_some( ) ) ;
82- assert ! ( !mined_entry. transaction. transaction. input . is_empty( ) ) ;
83- assert ! ( !mined_entry. transaction. transaction. output . is_empty( ) ) ;
85+ assert ! ( !mined_entry. transaction. transaction. inputs . is_empty( ) ) ;
86+ assert ! ( !mined_entry. transaction. transaction. outputs . is_empty( ) ) ;
8487
8588 let json: GetBlockVerboseThree =
8689 node. client . get_block_verbose_three ( block_hash) . expect ( "getblock verbose=3" ) ;
@@ -140,7 +143,6 @@ fn blockchain__get_block_filter__modelled() {
140143#[ test]
141144#[ cfg( not( feature = "v22_and_below" ) ) ]
142145fn blockchain__get_block_from_peer ( ) {
143- use bitcoin:: hashes:: Hash ;
144146 let ( node1, _node2, _node3) = integration_test:: three_node_network ( ) ;
145147
146148 let now = std:: time:: SystemTime :: now ( )
@@ -152,8 +154,8 @@ fn blockchain__get_block_from_peer() {
152154 let mut header = bitcoin:: block:: Header {
153155 version : bitcoin:: block:: Version :: from_consensus ( 0x20000000 ) ,
154156 prev_blockhash : node1. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ,
155- merkle_root : bitcoin:: TxMerkleNode :: all_zeros ( ) ,
156- time : now,
157+ merkle_root : bitcoin:: TxMerkleNode :: from_byte_array ( [ 0_u8 ; 32 ] ) ,
158+ time : bitcoin :: BlockTime :: from_u32 ( now) ,
157159 bits : bitcoin:: CompactTarget :: from_consensus ( 0x207fffff ) ,
158160 nonce : 0 ,
159161 } ;
@@ -173,7 +175,7 @@ fn blockchain__get_block_hash__modelled() {
173175 let node = Node :: with_wallet ( Wallet :: None , & [ ] ) ;
174176
175177 let json: GetBlockHash = node. client . get_block_hash ( 0 ) . expect ( "getblockhash" ) ;
176- let model: Result < mtype:: GetBlockHash , hex:: HexToArrayError > = json. into_model ( ) ;
178+ let model: Result < mtype:: GetBlockHash , hex:: DecodeFixedLengthBytesError > = json. into_model ( ) ;
177179 model. unwrap ( ) ;
178180}
179181
@@ -349,7 +351,8 @@ fn blockchain__get_mempool_ancestors__modelled() {
349351
350352 let json: GetMempoolAncestors =
351353 node. client . get_mempool_ancestors ( child_txid) . expect ( "getmempoolancestors" ) ;
352- let model: Result < mtype:: GetMempoolAncestors , hex:: HexToArrayError > = json. into_model ( ) ;
354+ let model: Result < mtype:: GetMempoolAncestors , hex:: DecodeFixedLengthBytesError > =
355+ json. into_model ( ) ;
353356 let ancestors = model. unwrap ( ) ;
354357
355358 assert ! ( ancestors. 0 . contains( & parent_txid) ) ;
@@ -379,7 +382,8 @@ fn blockchain__get_mempool_descendants__modelled() {
379382
380383 let json: GetMempoolDescendants =
381384 node. client . get_mempool_descendants ( parent_txid) . expect ( "getmempooldescendants" ) ;
382- let model: Result < mtype:: GetMempoolDescendants , hex:: HexToArrayError > = json. into_model ( ) ;
385+ let model: Result < mtype:: GetMempoolDescendants , hex:: DecodeFixedLengthBytesError > =
386+ json. into_model ( ) ;
383387 let descendants = model. unwrap ( ) ;
384388
385389 assert ! ( descendants. 0 . contains( & child_txid) ) ;
@@ -436,7 +440,8 @@ fn blockchain__get_raw_mempool__modelled() {
436440
437441 // verbose = false + mempool_sequence = false
438442 let json: GetRawMempool = node. client . get_raw_mempool ( ) . expect ( "getrawmempool" ) ;
439- let model: Result < mtype:: GetRawMempool , hex:: HexToArrayError > = json. clone ( ) . into_model ( ) ;
443+ let model: Result < mtype:: GetRawMempool , hex:: DecodeFixedLengthBytesError > =
444+ json. clone ( ) . into_model ( ) ;
440445 let mempool = model. unwrap ( ) ;
441446 // Sanity check.
442447 assert_eq ! ( mempool. 0 . len( ) , 1 ) ;
@@ -454,7 +459,8 @@ fn blockchain__get_raw_mempool__modelled() {
454459 // verbose = false + mempool_sequence = true
455460 let json: GetRawMempoolSequence =
456461 node. client . get_raw_mempool_sequence ( ) . expect ( "getrawmempool sequence" ) ;
457- let model: Result < mtype:: GetRawMempoolSequence , hex:: HexToArrayError > = json. into_model ( ) ;
462+ let model: Result < mtype:: GetRawMempoolSequence , hex:: DecodeFixedLengthBytesError > =
463+ json. into_model ( ) ;
458464 let mempool = model. unwrap ( ) ;
459465 // Sanity check.
460466 assert_eq ! ( mempool. txids. len( ) , 1 ) ;
@@ -646,7 +652,8 @@ fn blockchain__verify_tx_out_proof__modelled() {
646652 let proof = node. client . get_tx_out_proof ( & [ txid] ) . expect ( "gettxoutproof" ) ;
647653
648654 let json: VerifyTxOutProof = node. client . verify_tx_out_proof ( & proof) . expect ( "verifytxoutproof" ) ;
649- let model: Result < mtype:: VerifyTxOutProof , hex:: HexToArrayError > = json. into_model ( ) ;
655+ let model: Result < mtype:: VerifyTxOutProof , hex:: DecodeFixedLengthBytesError > =
656+ json. into_model ( ) ;
650657 let txids = model. unwrap ( ) ;
651658
652659 // sanity check
@@ -713,7 +720,7 @@ fn blockchain__wait_for_new_block__modelled() {
713720fn create_child_spending_parent ( node : & Node , parent_txid : bitcoin:: Txid ) -> bitcoin:: Txid {
714721 let inputs = vec ! [ Input { txid: parent_txid, vout: 0 , sequence: None } ] ;
715722 let spend_address = node. client . new_address ( ) . expect ( "newaddress" ) ;
716- let outputs = vec ! [ Output :: new( spend_address, bitcoin:: Amount :: from_sat ( 100_000 ) ) ] ;
723+ let outputs = vec ! [ Output :: new( spend_address, bitcoin:: Amount :: from_sat_u32 ( 100_000 ) ) ] ;
717724
718725 let raw: CreateRawTransaction =
719726 node. client . create_raw_transaction ( & inputs, & outputs) . expect ( "createrawtransaction" ) ;
0 commit comments