Skip to content

Commit 3614472

Browse files
committed
Limit the blocks to demonstrate consolidation
1 parent 08a212b commit 3614472

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

payjoin/tests/integration.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,11 +1273,11 @@ mod integration {
12731273
let (bitcoind, sender, receiver) = init_bitcoind_sender_receiver(None, None)?;
12741274
// Generate more UTXOs for the receiver
12751275
let receiver_address = receiver.new_address_with_type(AddressType::Bech32)?;
1276-
bitcoind.client.generate_to_address(199, &receiver_address)?;
1276+
bitcoind.client.generate_to_address(102, &receiver_address)?;
12771277
let receiver_utxos = receiver.list_unspent()?.0;
1278-
assert_eq!(100, receiver_utxos.len(), "receiver doesn't have enough UTXOs");
1278+
assert_eq!(3, receiver_utxos.len(), "receiver doesn't have enough UTXOs");
12791279
assert_eq!(
1280-
Amount::from_btc(3650.0)?, // 50 (starting receiver balance) + 46*50.0 + 52*25.0 (halving occurs every 150 blocks)
1280+
Amount::from_btc(150.0)?, // 50 (starting receiver balance) + 2*50.0
12811281
receiver.get_balances()?.into_model()?.mine.trusted,
12821282
"receiver doesn't have enough bitcoin"
12831283
);
@@ -1298,7 +1298,7 @@ mod integration {
12981298
.map_err(|e| e.to_string())?;
12991299
let psbt = build_original_psbt(&sender, &uri)?;
13001300
tracing::debug!("Original psbt: {psbt:#?}");
1301-
let max_additional_fee = Amount::from_sat(1000);
1301+
let max_additional_fee = Amount::from_sat(100);
13021302
let (req, ctx) = SenderBuilder::new(psbt.clone(), uri)
13031303
.build_with_additional_fee(max_additional_fee, None, FeeRate::ZERO, false)?
13041304
.create_v1_post_request();
@@ -1308,7 +1308,7 @@ mod integration {
13081308
// Inside the Receiver:
13091309
// this data would transit from one party to another over the network in production
13101310
let outputs = vec![TxOut {
1311-
value: Amount::from_btc(3650.0)?,
1311+
value: Amount::from_btc(150.0)?,
13121312
script_pubkey: receiver.new_address()?.script_pubkey(),
13131313
}];
13141314
let drain_script = outputs[0].script_pubkey.clone();
@@ -1329,7 +1329,7 @@ mod integration {
13291329
let checked_payjoin_proposal_psbt = ctx.process_response(response.as_bytes())?;
13301330
let network_fees = checked_payjoin_proposal_psbt.fee()?;
13311331
let expected_weight = Weight::from_wu(
1332-
TX_HEADER_WEIGHT + (P2WPKH_INPUT_WEIGHT * 101) + (P2WPKH_OUTPUT_WEIGHT * 2),
1332+
TX_HEADER_WEIGHT + (P2WPKH_INPUT_WEIGHT * 4) + (P2WPKH_OUTPUT_WEIGHT * 2),
13331333
);
13341334
let expected_fee = expected_weight * FeeRate::BROADCAST_MIN;
13351335
assert_eq!(network_fees, expected_fee);
@@ -1342,11 +1342,11 @@ mod integration {
13421342
let sender_fee = original_tx_fee + max_additional_fee;
13431343
// The receiver pays the difference
13441344
let receiver_fee = network_fees - sender_fee;
1345-
assert_eq!(payjoin_tx.input.len(), 101);
1345+
assert_eq!(payjoin_tx.input.len(), 4);
13461346
assert_eq!(payjoin_tx.output.len(), 2);
13471347
assert_eq!(
13481348
receiver.get_balances()?.into_model()?.mine.untrusted_pending,
1349-
Amount::from_btc(3651.0)? - receiver_fee
1349+
Amount::from_btc(151.0)? - receiver_fee
13501350
);
13511351
assert_eq!(
13521352
sender.get_balances()?.into_model()?.mine.untrusted_pending,

0 commit comments

Comments
 (0)