66
77#[ cfg( feature = "v30_and_below" ) ]
88use bitcoin:: consensus:: encode;
9- use bitcoin:: hex;
9+ use bitcoin:: { hex, Address , BlockHash , Transaction , Txid } ;
1010use bitcoind:: vtype:: * ; // All the version specific types.
1111use bitcoind:: { mtype, Input , Output } ;
1212use integration_test:: { BitcoinD , BitcoinDExt as _, Wallet } ;
@@ -144,7 +144,7 @@ fn blockchain__get_best_block_hash__modelled() {
144144#[ cfg( feature = "v30_and_below" ) ]
145145fn blockchain__get_block__modelled ( ) {
146146 let node = BitcoinD :: with_wallet ( Wallet :: None , & [ ] ) ;
147- let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
147+ let block_hash: BlockHash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
148148
149149 let json: GetBlockVerboseZero =
150150 node. client . get_block_verbose_zero ( block_hash) . expect ( "getblock verbose=0" ) ;
@@ -161,7 +161,7 @@ fn blockchain__get_block__modelled() {
161161 let node = BitcoinD :: with_wallet ( Wallet :: Default , & [ ] ) ;
162162 node. fund_wallet ( ) ;
163163 let ( _address, mined_tx) = node. create_mined_transaction ( ) ;
164- let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
164+ let block_hash: BlockHash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
165165
166166 let json: GetBlockVerboseTwo =
167167 node. client . get_block_verbose_two ( block_hash) . expect ( "getblock verbose=2" ) ;
@@ -228,7 +228,7 @@ fn blockchain__get_block_count__modelled() {
228228fn blockchain__get_block_filter__modelled ( ) {
229229 let node = BitcoinD :: with_wallet ( Wallet :: Default , & [ "-blockfilterindex" ] ) ;
230230 node. mine_a_block ( ) ;
231- let hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
231+ let hash: BlockHash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
232232
233233 let json: GetBlockFilter = node. client . get_block_filter ( hash) . expect ( "getblockfilter" ) ;
234234 let model: Result < mtype:: GetBlockFilter , GetBlockFilterError > = json. into_model ( ) ;
@@ -279,7 +279,7 @@ fn blockchain__get_block_hash__modelled() {
279279#[ test]
280280fn blockchain__get_block_header__modelled ( ) {
281281 let node = BitcoinD :: with_wallet ( Wallet :: None , & [ ] ) ;
282- let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
282+ let block_hash: BlockHash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
283283
284284 // verbose = false
285285 let json: GetBlockHeader = node. client . get_block_header ( & block_hash) . expect ( "getblockheader" ) ;
@@ -321,7 +321,7 @@ fn get_block_stats_by_height(node: &BitcoinD) {
321321}
322322
323323fn get_block_stats_by_block_hash ( node : & BitcoinD ) {
324- let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
324+ let block_hash: BlockHash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
325325 let json: GetBlockStats =
326326 node. client . get_block_stats_by_block_hash ( & block_hash, None ) . expect ( "getblockstats" ) ;
327327
@@ -396,7 +396,7 @@ fn blockchain__get_deployment_info__modelled() {
396396 . expect ( "best_block_hash failed" )
397397 . block_hash ( )
398398 . expect ( "block_hash parse failed" ) ;
399- let tip_block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
399+ let tip_block_hash: BlockHash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
400400
401401 let json: GetDeploymentInfo =
402402 node. client . get_deployment_info ( & first_block_hash) . expect ( "getdeploymentinfo" ) ;
@@ -427,7 +427,8 @@ fn blockchain__get_descriptor_activity__modelled() {
427427
428428 #[ cfg( not( feature = "v29_and_below" ) ) ]
429429 {
430- let block_hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
430+ let block_hash: BlockHash =
431+ node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
431432 node. client
432433 . get_descriptor_activity (
433434 & [ block_hash] ,
@@ -639,7 +640,7 @@ fn blockchain__import_mempool() {
639640 node. fund_wallet ( ) ;
640641 let ( _address, _tx) = node. create_mined_transaction ( ) ;
641642
642- let mempool_path = node. client . save_mempool ( ) . expect ( "savemempool" ) ;
643+ let mempool_path: ( ) = node. client . save_mempool ( ) . expect ( "savemempool" ) ;
643644
644645 let _: ( ) = node. client . import_mempool ( & mempool_path. filename ) . expect ( "importmempool" ) ;
645646}
@@ -648,7 +649,7 @@ fn blockchain__import_mempool() {
648649fn blockchain__precious_block ( ) {
649650 let node = BitcoinD :: with_wallet ( Wallet :: Default , & [ ] ) ;
650651 node. mine_a_block ( ) ;
651- let hash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
652+ let hash: BlockHash = node. client . best_block_hash ( ) . expect ( "best_block_hash failed" ) ;
652653 node. mine_a_block ( ) ;
653654
654655 let _: ( ) = node. client . precious_block ( hash) . expect ( "preciousblock" ) ;
@@ -659,7 +660,7 @@ fn blockchain__prune_blockchain() {
659660 const NBLOCKS : usize = 1 ;
660661
661662 let node = BitcoinD :: with_wallet ( Wallet :: Default , & [ "-prune=550" ] ) ;
662- let address = node. client . new_address ( ) . expect ( "Failed to get new address" ) ;
663+ let address: Address = node. client . new_address ( ) . expect ( "Failed to get new address" ) ;
663664
664665 let gen_result = node
665666 . client
@@ -754,13 +755,13 @@ fn blockchain__verify_tx_out_proof__modelled() {
754755 node. fund_wallet ( ) ;
755756
756757 let ( _address, tx) = node. create_mined_transaction ( ) ;
757- let txid = tx. compute_txid ( ) ;
758+ let txid: Txid = tx. compute_txid ( ) ;
758759
759- let proof = node. client . get_tx_out_proof ( & [ txid] ) . expect ( "gettxoutproof" ) ;
760+ let proof: String = node. client . get_tx_out_proof ( & [ txid] ) . expect ( "gettxoutproof" ) ;
760761
761762 let json: VerifyTxOutProof = node. client . verify_tx_out_proof ( & proof) . expect ( "verifytxoutproof" ) ;
762763 let model: Result < mtype:: VerifyTxOutProof , hex:: HexToArrayError > = json. into_model ( ) ;
763- let txids = model. unwrap ( ) ;
764+ let txids: mtype :: VerifyTxOutProof = model. unwrap ( ) ;
764765
765766 // sanity check
766767 assert_eq ! ( txids. 0 . len( ) , 1 ) ;
@@ -771,7 +772,7 @@ fn blockchain__wait_for_block__modelled() {
771772 let node = BitcoinD :: with_wallet ( Wallet :: Default , & [ ] ) ;
772773 node. fund_wallet ( ) ;
773774 let ( _address, _tx) = node. create_mined_transaction ( ) ;
774- let block_hash = node. client . best_block_hash ( ) . expect ( "bestblockhash" ) ;
775+ let block_hash: BlockHash = node. client . best_block_hash ( ) . expect ( "bestblockhash" ) ;
775776
776777 let json: WaitForBlock = node. client . wait_for_block ( & block_hash) . expect ( "waitforblock" ) ;
777778 let model: Result < mtype:: WaitForBlock , WaitForBlockError > = json. into_model ( ) ;
@@ -784,8 +785,8 @@ fn blockchain__wait_for_block_height__modelled() {
784785 let node = BitcoinD :: with_wallet ( Wallet :: Default , & [ ] ) ;
785786 node. fund_wallet ( ) ;
786787 let ( _address, _tx) = node. create_mined_transaction ( ) ;
787- let height = node. client . get_block_count ( ) . expect ( "getblockcount" ) . 0 ;
788- let block_hash = node. client . best_block_hash ( ) . expect ( "bestblockhash" ) ;
788+ let height: u64 = node. client . get_block_count ( ) . expect ( "getblockcount" ) . 0 ;
789+ let block_hash: BlockHash = node. client . best_block_hash ( ) . expect ( "bestblockhash" ) ;
789790 let target_height = height;
790791
791792 let json: WaitForBlockHeight =
@@ -826,16 +827,16 @@ fn blockchain__wait_for_new_block__modelled() {
826827/// Returns the child's txid.
827828fn create_child_spending_parent ( node : & BitcoinD , parent_txid : bitcoin:: Txid ) -> bitcoin:: Txid {
828829 let inputs = vec ! [ Input { txid: parent_txid, vout: 0 , sequence: None } ] ;
829- let spend_address = node. client . new_address ( ) . expect ( "newaddress" ) ;
830+ let spend_address: Address = node. client . new_address ( ) . expect ( "newaddress" ) ;
830831 let outputs = vec ! [ Output :: new( spend_address, bitcoin:: Amount :: from_sat( 100_000 ) ) ] ;
831832
832833 let raw: CreateRawTransaction =
833834 node. client . create_raw_transaction ( & inputs, & outputs) . expect ( "createrawtransaction" ) ;
834- let unsigned = raw. transaction ( ) . expect ( "raw.transaction" ) ;
835+ let unsigned: Transaction = raw. transaction ( ) . expect ( "raw.transaction" ) ;
835836
836837 let funded: FundRawTransaction =
837838 node. client . fund_raw_transaction ( & unsigned) . expect ( "fundrawtransaction" ) ;
838- let funded_tx = funded. transaction ( ) . expect ( "funded.transaction" ) ;
839+ let funded_tx: Transaction = funded. transaction ( ) . expect ( "funded.transaction" ) ;
839840
840841 let signed: SignRawTransaction = node
841842 . client
@@ -844,7 +845,8 @@ fn create_child_spending_parent(node: &BitcoinD, parent_txid: bitcoin::Txid) ->
844845 let sign_raw_transaction =
845846 signed. into_model ( ) . expect ( "SignRawTransactionWithWallet into model" ) ;
846847 let child_txid = sign_raw_transaction. tx . compute_txid ( ) ;
847- let _ = node. client . send_raw_transaction ( & sign_raw_transaction. tx ) . expect ( "sendrawtransaction" ) ;
848+ let _: SendRawTransaction =
849+ node. client . send_raw_transaction ( & sign_raw_transaction. tx ) . expect ( "sendrawtransaction" ) ;
848850
849851 child_txid
850852}
0 commit comments