@@ -1427,12 +1427,12 @@ fn test_create_tx_increment_change_index() {
14271427 descriptor : & ' static str ,
14281428 change_descriptor : Option < & ' static str > ,
14291429 // amount to send
1430- to_send : u64 ,
1430+ to_send : Amount ,
14311431 // (derivation index, next unused index) of *change keychain*
14321432 expect : ( Option < u32 > , u32 ) ,
14331433 }
14341434 // total wallet funds
1435- let amount = 10_000 ;
1435+ let amount = Amount :: from_sat ( 10_000 ) ;
14361436 let recipient = Address :: from_str ( "bcrt1q3qtze4ys45tgdvguj66zrk4fu6hq3a3v9pfly5" )
14371437 . unwrap ( )
14381438 . assume_checked ( )
@@ -1443,55 +1443,55 @@ fn test_create_tx_increment_change_index() {
14431443 name : "two wildcard, builder error" ,
14441444 descriptor : desc,
14451445 change_descriptor : Some ( change_desc) ,
1446- to_send : amount + 1 ,
1446+ to_send : amount + Amount :: from_sat ( 1 ) ,
14471447 // should not use or derive change index
14481448 expect : ( None , 0 ) ,
14491449 } ,
14501450 TestCase {
14511451 name : "two wildcard, create change" ,
14521452 descriptor : desc,
14531453 change_descriptor : Some ( change_desc) ,
1454- to_send : 5_000 ,
1454+ to_send : Amount :: from_sat ( 5_000 ) ,
14551455 // should use change index
14561456 expect : ( Some ( 0 ) , 1 ) ,
14571457 } ,
14581458 TestCase {
14591459 name : "two wildcard, no change" ,
14601460 descriptor : desc,
14611461 change_descriptor : Some ( change_desc) ,
1462- to_send : 9_850 ,
1462+ to_send : Amount :: from_sat ( 9_850 ) ,
14631463 // should not use change index
14641464 expect : ( None , 0 ) ,
14651465 } ,
14661466 TestCase {
14671467 name : "one wildcard, create change" ,
14681468 descriptor : desc,
14691469 change_descriptor : None ,
1470- to_send : 5_000 ,
1470+ to_send : Amount :: from_sat ( 5_000 ) ,
14711471 // should use change index of external keychain
14721472 expect : ( Some ( 1 ) , 2 ) ,
14731473 } ,
14741474 TestCase {
14751475 name : "one wildcard, no change" ,
14761476 descriptor : desc,
14771477 change_descriptor : None ,
1478- to_send : 9_850 ,
1478+ to_send : Amount :: from_sat ( 9_850 ) ,
14791479 // should not use change index
14801480 expect : ( Some ( 0 ) , 1 ) ,
14811481 } ,
14821482 TestCase {
14831483 name : "single key, create change" ,
14841484 descriptor : get_test_tr_single_sig ( ) ,
14851485 change_descriptor : None ,
1486- to_send : 5_000 ,
1486+ to_send : Amount :: from_sat ( 5_000 ) ,
14871487 // single key only has one derivation index (0)
14881488 expect : ( Some ( 0 ) , 0 ) ,
14891489 } ,
14901490 TestCase {
14911491 name : "single key, no change" ,
14921492 descriptor : get_test_tr_single_sig ( ) ,
14931493 change_descriptor : None ,
1494- to_send : 9_850 ,
1494+ to_send : Amount :: from_sat ( 9_850 ) ,
14951495 expect : ( Some ( 0 ) , 0 ) ,
14961496 } ,
14971497 ]
@@ -1516,7 +1516,7 @@ fn test_create_tx_increment_change_index() {
15161516 receive_output ( & mut wallet, amount, ReceiveTo :: Mempool ( 0 ) ) ;
15171517 // create tx
15181518 let mut builder = wallet. build_tx ( ) ;
1519- builder. add_recipient ( recipient. clone ( ) , Amount :: from_sat ( test. to_send ) ) ;
1519+ builder. add_recipient ( recipient. clone ( ) , test. to_send ) ;
15201520 let res = builder. finish ( ) ;
15211521 if !test. name . contains ( "error" ) {
15221522 assert ! ( res. is_ok( ) ) ;
@@ -2289,7 +2289,7 @@ fn test_bump_fee_add_input() {
22892289#[ test]
22902290fn test_bump_fee_absolute_add_input ( ) {
22912291 let ( mut wallet, _) = get_funded_wallet_wpkh ( ) ;
2292- receive_output_in_latest_block ( & mut wallet, 25_000 ) ;
2292+ receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 25_000 ) ) ;
22932293 let addr = Address :: from_str ( "2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX" )
22942294 . unwrap ( )
22952295 . assume_checked ( ) ;
@@ -2343,7 +2343,7 @@ fn test_bump_fee_absolute_add_input() {
23432343#[ test]
23442344fn test_bump_fee_no_change_add_input_and_change ( ) {
23452345 let ( mut wallet, _) = get_funded_wallet_wpkh ( ) ;
2346- let op = receive_output_in_latest_block ( & mut wallet, 25_000 ) ;
2346+ let op = receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 25_000 ) ) ;
23472347
23482348 // initially make a tx without change by using `drain_to`
23492349 let addr = Address :: from_str ( "2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX" )
@@ -2409,7 +2409,7 @@ fn test_bump_fee_no_change_add_input_and_change() {
24092409#[ test]
24102410fn test_bump_fee_add_input_change_dust ( ) {
24112411 let ( mut wallet, _) = get_funded_wallet_wpkh ( ) ;
2412- receive_output_in_latest_block ( & mut wallet, 25_000 ) ;
2412+ receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 25_000 ) ) ;
24132413 let addr = Address :: from_str ( "2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX" )
24142414 . unwrap ( )
24152415 . assume_checked ( ) ;
@@ -2481,7 +2481,7 @@ fn test_bump_fee_add_input_change_dust() {
24812481#[ test]
24822482fn test_bump_fee_force_add_input ( ) {
24832483 let ( mut wallet, _) = get_funded_wallet_wpkh ( ) ;
2484- let incoming_op = receive_output_in_latest_block ( & mut wallet, 25_000 ) ;
2484+ let incoming_op = receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 25_000 ) ) ;
24852485
24862486 let addr = Address :: from_str ( "2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX" )
24872487 . unwrap ( )
@@ -2543,7 +2543,7 @@ fn test_bump_fee_force_add_input() {
25432543#[ test]
25442544fn test_bump_fee_absolute_force_add_input ( ) {
25452545 let ( mut wallet, _) = get_funded_wallet_wpkh ( ) ;
2546- let incoming_op = receive_output_in_latest_block ( & mut wallet, 25_000 ) ;
2546+ let incoming_op = receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 25_000 ) ) ;
25472547
25482548 let addr = Address :: from_str ( "2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX" )
25492549 . unwrap ( )
@@ -2622,7 +2622,7 @@ fn test_bump_fee_unconfirmed_inputs_only() {
26222622 let psbt = builder. finish ( ) . unwrap ( ) ;
26232623 // Now we receive one transaction with 0 confirmations. We won't be able to use that for
26242624 // fee bumping, as it's still unconfirmed!
2625- receive_output ( & mut wallet, 25_000 , ReceiveTo :: Mempool ( 0 ) ) ;
2625+ receive_output ( & mut wallet, Amount :: from_sat ( 25_000 ) , ReceiveTo :: Mempool ( 0 ) ) ;
26262626 let mut tx = psbt. extract_tx ( ) . expect ( "failed to extract tx" ) ;
26272627 let txid = tx. compute_txid ( ) ;
26282628 for txin in & mut tx. input {
@@ -2647,7 +2647,7 @@ fn test_bump_fee_unconfirmed_input() {
26472647 . assume_checked ( ) ;
26482648 // We receive a tx with 0 confirmations, which will be used as an input
26492649 // in the drain tx.
2650- receive_output ( & mut wallet, 25_000 , ReceiveTo :: Mempool ( 0 ) ) ;
2650+ receive_output ( & mut wallet, Amount :: from_sat ( 25_000 ) , ReceiveTo :: Mempool ( 0 ) ) ;
26512651 let mut builder = wallet. build_tx ( ) ;
26522652 builder. drain_wallet ( ) . drain_to ( addr. script_pubkey ( ) ) ;
26532653 let psbt = builder. finish ( ) . unwrap ( ) ;
@@ -2685,7 +2685,7 @@ fn test_fee_amount_negative_drain_val() {
26852685 . unwrap ( )
26862686 . assume_checked ( ) ;
26872687 let fee_rate = FeeRate :: from_sat_per_kwu ( 500 ) ;
2688- let incoming_op = receive_output_in_latest_block ( & mut wallet, 8859 ) ;
2688+ let incoming_op = receive_output_in_latest_block ( & mut wallet, Amount :: from_sat ( 8859 ) ) ;
26892689
26902690 let mut builder = wallet. build_tx ( ) ;
26912691 builder
@@ -3057,7 +3057,7 @@ fn test_next_unused_address() {
30573057 assert_eq ! ( next_unused_addr. index, 0 ) ;
30583058
30593059 // use the above address
3060- receive_output ( & mut wallet, 25_000 , ReceiveTo :: Mempool ( 0 ) ) ;
3060+ receive_output ( & mut wallet, Amount :: from_sat ( 25_000 ) , ReceiveTo :: Mempool ( 0 ) ) ;
30613061
30623062 assert_eq ! (
30633063 wallet
@@ -4133,7 +4133,7 @@ fn test_keychains_with_overlapping_spks() {
41334133 } ,
41344134 confirmation_time : 0 ,
41354135 } ;
4136- let _outpoint = receive_output_to_address ( & mut wallet, addr, 8000 , anchor) ;
4136+ let _outpoint = receive_output_to_address ( & mut wallet, addr, Amount :: from_sat ( 8000 ) , anchor) ;
41374137 assert_eq ! ( wallet. balance( ) . confirmed, Amount :: from_sat( 58000 ) ) ;
41384138}
41394139
@@ -4222,14 +4222,14 @@ fn single_descriptor_wallet_can_create_tx_and_receive_change() {
42224222 . create_wallet_no_persist ( )
42234223 . unwrap ( ) ;
42244224 assert_eq ! ( wallet. keychains( ) . count( ) , 1 ) ;
4225- let amt = Amount :: from_sat ( 5_000 ) ;
4226- receive_output ( & mut wallet, 2 * amt . to_sat ( ) , ReceiveTo :: Mempool ( 2 ) ) ;
4225+ let amount = Amount :: from_sat ( 5_000 ) ;
4226+ receive_output ( & mut wallet, amount * 2 , ReceiveTo :: Mempool ( 2 ) ) ;
42274227 // create spend tx that produces a change output
42284228 let addr = Address :: from_str ( "bcrt1qc6fweuf4xjvz4x3gx3t9e0fh4hvqyu2qw4wvxm" )
42294229 . unwrap ( )
42304230 . assume_checked ( ) ;
42314231 let mut builder = wallet. build_tx ( ) ;
4232- builder. add_recipient ( addr. script_pubkey ( ) , amt ) ;
4232+ builder. add_recipient ( addr. script_pubkey ( ) , amount ) ;
42334233 let mut psbt = builder. finish ( ) . unwrap ( ) ;
42344234 assert ! ( wallet. sign( & mut psbt, SignOptions :: default ( ) ) . unwrap( ) ) ;
42354235 let tx = psbt. extract_tx ( ) . unwrap ( ) ;
@@ -4238,7 +4238,7 @@ fn single_descriptor_wallet_can_create_tx_and_receive_change() {
42384238 let unspent: Vec < _ > = wallet. list_unspent ( ) . collect ( ) ;
42394239 assert_eq ! ( unspent. len( ) , 1 ) ;
42404240 let utxo = unspent. first ( ) . unwrap ( ) ;
4241- assert ! ( utxo. txout. value < amt ) ;
4241+ assert ! ( utxo. txout. value < amount ) ;
42424242 assert_eq ! (
42434243 utxo. keychain,
42444244 KeychainKind :: External ,
@@ -4249,7 +4249,7 @@ fn single_descriptor_wallet_can_create_tx_and_receive_change() {
42494249#[ test]
42504250fn test_transactions_sort_by ( ) {
42514251 let ( mut wallet, _txid) = get_funded_wallet_wpkh ( ) ;
4252- receive_output ( & mut wallet, 25_000 , ReceiveTo :: Mempool ( 0 ) ) ;
4252+ receive_output ( & mut wallet, Amount :: from_sat ( 25_000 ) , ReceiveTo :: Mempool ( 0 ) ) ;
42534253
42544254 // sort by chain position, unconfirmed then confirmed by descending block height
42554255 let sorted_txs: Vec < WalletTx > =
0 commit comments