@@ -1423,12 +1423,12 @@ fn test_create_tx_increment_change_index() {
14231423 descriptor : & ' static str ,
14241424 change_descriptor : Option < & ' static str > ,
14251425 // amount to send
1426- to_send : u64 ,
1426+ to_send : Amount ,
14271427 // (derivation index, next unused index) of *change keychain*
14281428 expect : ( Option < u32 > , u32 ) ,
14291429 }
14301430 // total wallet funds
1431- let amount = 10_000 ;
1431+ let amount = Amount :: from_sat ( 10_000 ) ;
14321432 let recipient = Address :: from_str ( "bcrt1q3qtze4ys45tgdvguj66zrk4fu6hq3a3v9pfly5" )
14331433 . unwrap ( )
14341434 . assume_checked ( )
@@ -1439,55 +1439,55 @@ fn test_create_tx_increment_change_index() {
14391439 name : "two wildcard, builder error" ,
14401440 descriptor : desc,
14411441 change_descriptor : Some ( change_desc) ,
1442- to_send : amount + 1 ,
1442+ to_send : amount + Amount :: from_sat ( 1 ) ,
14431443 // should not use or derive change index
14441444 expect : ( None , 0 ) ,
14451445 } ,
14461446 TestCase {
14471447 name : "two wildcard, create change" ,
14481448 descriptor : desc,
14491449 change_descriptor : Some ( change_desc) ,
1450- to_send : 5_000 ,
1450+ to_send : Amount :: from_sat ( 5_000 ) ,
14511451 // should use change index
14521452 expect : ( Some ( 0 ) , 1 ) ,
14531453 } ,
14541454 TestCase {
14551455 name : "two wildcard, no change" ,
14561456 descriptor : desc,
14571457 change_descriptor : Some ( change_desc) ,
1458- to_send : 9_850 ,
1458+ to_send : Amount :: from_sat ( 9_850 ) ,
14591459 // should not use change index
14601460 expect : ( None , 0 ) ,
14611461 } ,
14621462 TestCase {
14631463 name : "one wildcard, create change" ,
14641464 descriptor : desc,
14651465 change_descriptor : None ,
1466- to_send : 5_000 ,
1466+ to_send : Amount :: from_sat ( 5_000 ) ,
14671467 // should use change index of external keychain
14681468 expect : ( Some ( 1 ) , 2 ) ,
14691469 } ,
14701470 TestCase {
14711471 name : "one wildcard, no change" ,
14721472 descriptor : desc,
14731473 change_descriptor : None ,
1474- to_send : 9_850 ,
1474+ to_send : Amount :: from_sat ( 9_850 ) ,
14751475 // should not use change index
14761476 expect : ( Some ( 0 ) , 1 ) ,
14771477 } ,
14781478 TestCase {
14791479 name : "single key, create change" ,
14801480 descriptor : get_test_tr_single_sig ( ) ,
14811481 change_descriptor : None ,
1482- to_send : 5_000 ,
1482+ to_send : Amount :: from_sat ( 5_000 ) ,
14831483 // single key only has one derivation index (0)
14841484 expect : ( Some ( 0 ) , 0 ) ,
14851485 } ,
14861486 TestCase {
14871487 name : "single key, no change" ,
14881488 descriptor : get_test_tr_single_sig ( ) ,
14891489 change_descriptor : None ,
1490- to_send : 9_850 ,
1490+ to_send : Amount :: from_sat ( 9_850 ) ,
14911491 expect : ( Some ( 0 ) , 0 ) ,
14921492 } ,
14931493 ]
@@ -1512,7 +1512,7 @@ fn test_create_tx_increment_change_index() {
15121512 receive_output ( & mut wallet, amount, ReceiveTo :: Mempool ( 0 ) ) ;
15131513 // create tx
15141514 let mut builder = wallet. build_tx ( ) ;
1515- builder. add_recipient ( recipient. clone ( ) , Amount :: from_sat ( test. to_send ) ) ;
1515+ builder. add_recipient ( recipient. clone ( ) , test. to_send ) ;
15161516 let res = builder. finish ( ) ;
15171517 if !test. name . contains ( "error" ) {
15181518 assert ! ( res. is_ok( ) ) ;
@@ -2285,7 +2285,7 @@ fn test_bump_fee_add_input() {
22852285#[ test]
22862286fn test_bump_fee_absolute_add_input ( ) {
22872287 let ( mut wallet, _) = get_funded_wallet_wpkh ( ) ;
2288- receive_output_in_latest_block ( & mut wallet, 25_000 ) ;
2288+ receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 25_000 ) ) ;
22892289 let addr = Address :: from_str ( "2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX" )
22902290 . unwrap ( )
22912291 . assume_checked ( ) ;
@@ -2339,7 +2339,7 @@ fn test_bump_fee_absolute_add_input() {
23392339#[ test]
23402340fn test_bump_fee_no_change_add_input_and_change ( ) {
23412341 let ( mut wallet, _) = get_funded_wallet_wpkh ( ) ;
2342- let op = receive_output_in_latest_block ( & mut wallet, 25_000 ) ;
2342+ let op = receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 25_000 ) ) ;
23432343
23442344 // initially make a tx without change by using `drain_to`
23452345 let addr = Address :: from_str ( "2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX" )
@@ -2405,7 +2405,7 @@ fn test_bump_fee_no_change_add_input_and_change() {
24052405#[ test]
24062406fn test_bump_fee_add_input_change_dust ( ) {
24072407 let ( mut wallet, _) = get_funded_wallet_wpkh ( ) ;
2408- receive_output_in_latest_block ( & mut wallet, 25_000 ) ;
2408+ receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 25_000 ) ) ;
24092409 let addr = Address :: from_str ( "2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX" )
24102410 . unwrap ( )
24112411 . assume_checked ( ) ;
@@ -2477,7 +2477,7 @@ fn test_bump_fee_add_input_change_dust() {
24772477#[ test]
24782478fn test_bump_fee_force_add_input ( ) {
24792479 let ( mut wallet, _) = get_funded_wallet_wpkh ( ) ;
2480- let incoming_op = receive_output_in_latest_block ( & mut wallet, 25_000 ) ;
2480+ let incoming_op = receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 25_000 ) ) ;
24812481
24822482 let addr = Address :: from_str ( "2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX" )
24832483 . unwrap ( )
@@ -2539,7 +2539,7 @@ fn test_bump_fee_force_add_input() {
25392539#[ test]
25402540fn test_bump_fee_absolute_force_add_input ( ) {
25412541 let ( mut wallet, _) = get_funded_wallet_wpkh ( ) ;
2542- let incoming_op = receive_output_in_latest_block ( & mut wallet, 25_000 ) ;
2542+ let incoming_op = receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 25_000 ) ) ;
25432543
25442544 let addr = Address :: from_str ( "2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX" )
25452545 . unwrap ( )
@@ -2618,7 +2618,7 @@ fn test_bump_fee_unconfirmed_inputs_only() {
26182618 let psbt = builder. finish ( ) . unwrap ( ) ;
26192619 // Now we receive one transaction with 0 confirmations. We won't be able to use that for
26202620 // fee bumping, as it's still unconfirmed!
2621- receive_output ( & mut wallet, 25_000 , ReceiveTo :: Mempool ( 0 ) ) ;
2621+ receive_output ( & mut wallet, Amount :: from_sat ( 25_000 ) , ReceiveTo :: Mempool ( 0 ) ) ;
26222622 let mut tx = psbt. extract_tx ( ) . expect ( "failed to extract tx" ) ;
26232623 let txid = tx. compute_txid ( ) ;
26242624 for txin in & mut tx. input {
@@ -2643,7 +2643,7 @@ fn test_bump_fee_unconfirmed_input() {
26432643 . assume_checked ( ) ;
26442644 // We receive a tx with 0 confirmations, which will be used as an input
26452645 // in the drain tx.
2646- receive_output ( & mut wallet, 25_000 , ReceiveTo :: Mempool ( 0 ) ) ;
2646+ receive_output ( & mut wallet, Amount :: from_sat ( 25_000 ) , ReceiveTo :: Mempool ( 0 ) ) ;
26472647 let mut builder = wallet. build_tx ( ) ;
26482648 builder. drain_wallet ( ) . drain_to ( addr. script_pubkey ( ) ) ;
26492649 let psbt = builder. finish ( ) . unwrap ( ) ;
@@ -2681,7 +2681,7 @@ fn test_fee_amount_negative_drain_val() {
26812681 . unwrap ( )
26822682 . assume_checked ( ) ;
26832683 let fee_rate = FeeRate :: from_sat_per_kwu ( 500 ) ;
2684- let incoming_op = receive_output_in_latest_block ( & mut wallet, 8859 ) ;
2684+ let incoming_op = receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 8859 ) ) ;
26852685
26862686 let mut builder = wallet. build_tx ( ) ;
26872687 builder
@@ -3053,7 +3053,7 @@ fn test_next_unused_address() {
30533053 assert_eq ! ( next_unused_addr. index, 0 ) ;
30543054
30553055 // use the above address
3056- receive_output ( & mut wallet, 25_000 , ReceiveTo :: Mempool ( 0 ) ) ;
3056+ receive_output ( & mut wallet, Amount :: from_sat ( 25_000 ) , ReceiveTo :: Mempool ( 0 ) ) ;
30573057
30583058 assert_eq ! (
30593059 wallet
@@ -4129,7 +4129,7 @@ fn test_keychains_with_overlapping_spks() {
41294129 } ,
41304130 confirmation_time : 0 ,
41314131 } ;
4132- let _outpoint = receive_output_to_address ( & mut wallet, addr, 8000 , anchor) ;
4132+ let _outpoint = receive_output_to_address ( & mut wallet, addr, Amount :: from_sat ( 8000 ) , anchor) ;
41334133 assert_eq ! ( wallet. balance( ) . confirmed, Amount :: from_sat( 58000 ) ) ;
41344134}
41354135
@@ -4218,14 +4218,14 @@ fn single_descriptor_wallet_can_create_tx_and_receive_change() {
42184218 . create_wallet_no_persist ( )
42194219 . unwrap ( ) ;
42204220 assert_eq ! ( wallet. keychains( ) . count( ) , 1 ) ;
4221- let amt = Amount :: from_sat ( 5_000 ) ;
4222- receive_output ( & mut wallet, 2 * amt . to_sat ( ) , ReceiveTo :: Mempool ( 2 ) ) ;
4221+ let amount = Amount :: from_sat ( 5_000 ) ;
4222+ receive_output ( & mut wallet, amount * 2 , ReceiveTo :: Mempool ( 2 ) ) ;
42234223 // create spend tx that produces a change output
42244224 let addr = Address :: from_str ( "bcrt1qc6fweuf4xjvz4x3gx3t9e0fh4hvqyu2qw4wvxm" )
42254225 . unwrap ( )
42264226 . assume_checked ( ) ;
42274227 let mut builder = wallet. build_tx ( ) ;
4228- builder. add_recipient ( addr. script_pubkey ( ) , amt ) ;
4228+ builder. add_recipient ( addr. script_pubkey ( ) , amount ) ;
42294229 let mut psbt = builder. finish ( ) . unwrap ( ) ;
42304230 assert ! ( wallet. sign( & mut psbt, SignOptions :: default ( ) ) . unwrap( ) ) ;
42314231 let tx = psbt. extract_tx ( ) . unwrap ( ) ;
@@ -4234,7 +4234,7 @@ fn single_descriptor_wallet_can_create_tx_and_receive_change() {
42344234 let unspent: Vec < _ > = wallet. list_unspent ( ) . collect ( ) ;
42354235 assert_eq ! ( unspent. len( ) , 1 ) ;
42364236 let utxo = unspent. first ( ) . unwrap ( ) ;
4237- assert ! ( utxo. txout. value < amt ) ;
4237+ assert ! ( utxo. txout. value < amount ) ;
42384238 assert_eq ! (
42394239 utxo. keychain,
42404240 KeychainKind :: External ,
@@ -4245,7 +4245,7 @@ fn single_descriptor_wallet_can_create_tx_and_receive_change() {
42454245#[ test]
42464246fn test_transactions_sort_by ( ) {
42474247 let ( mut wallet, _txid) = get_funded_wallet_wpkh ( ) ;
4248- receive_output ( & mut wallet, 25_000 , ReceiveTo :: Mempool ( 0 ) ) ;
4248+ receive_output ( & mut wallet, Amount :: from_sat ( 25_000 ) , ReceiveTo :: Mempool ( 0 ) ) ;
42494249
42504250 // sort by chain position, unconfirmed then confirmed by descending block height
42514251 let sorted_txs: Vec < WalletTx > =
0 commit comments