Skip to content

Commit 1edab3b

Browse files
committed
f
1 parent 52464d8 commit 1edab3b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/payment/payjoin/send.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -130,22 +130,23 @@ impl PayjoinSender {
130130
) {
131131
let (index, tx) = txdata[0];
132132
let txid = tx.txid();
133-
let mut transactions = self.transactions.lock().unwrap();
134-
let position = transactions.iter().position(|o| o.txid() == Some(txid)).unwrap();
135-
let pj_tx = transactions.remove(position);
133+
let position = self.transactions.lock().unwrap().iter().position(|o| o.txid() == Some(txid)).unwrap();
134+
let pj_tx = self.transactions.lock().unwrap().remove(position);
136135
dbg!("found confirmed", &pj_tx);
137136
let pj_tx = match pj_tx {
138137
PayjoinTransaction::PendingFirstConfirmation {
139138
ref tx,
140139
first_broadcast_height,
141140
first_broadcast_hash,
142-
} => transactions.push(PayjoinTransaction::PendingThresholdConfirmations {
141+
} => {
142+
dbg!("Here in peding first confirmation");
143+
self.transactions.lock().unwrap().push(PayjoinTransaction::PendingThresholdConfirmations {
143144
tx: tx.clone(),
144145
first_broadcast_height,
145146
first_broadcast_hash,
146147
latest_confirmation_height: height,
147148
latest_confirmation_hash: header.block_hash(),
148-
}),
149+
})},
149150
PayjoinTransaction::PendingThresholdConfirmations {
150151
ref tx,
151152
first_broadcast_height,
@@ -159,7 +160,7 @@ impl PayjoinSender {
159160
if height - first_broadcast_height >= ANTI_REORG_DELAY {
160161
let _ = self.event_queue.add_event(Event::PayjoinTxSendSuccess { txid });
161162
} else {
162-
transactions.push(PayjoinTransaction::PendingThresholdConfirmations {
163+
self.transactions.lock().unwrap().push(PayjoinTransaction::PendingThresholdConfirmations {
163164
tx: tx.clone(),
164165
first_broadcast_height,
165166
first_broadcast_hash,

tests/integration_tests_payjoin.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ fn send_receive_regular_payjoin_transaction() {
3636
assert!(sender_payjoin_payment.send(payjoin_uri).is_ok());
3737
let txid = expect_payjoin_payment_pending_event!(node_b_pj_sender);
3838
wait_for_tx(&electrsd.client, txid);
39-
generate_blocks_and_wait(&bitcoind.client, &electrsd.client, 6);
39+
generate_blocks_and_wait(&bitcoind.client, &electrsd.client, 1);
40+
node_b_pj_sender.sync_wallets().unwrap();
41+
generate_blocks_and_wait(&bitcoind.client, &electrsd.client, 5);
4042
node_b_pj_sender.sync_wallets().unwrap();
4143
// expect_payjoin_payment_success_event!(node_b_pj_sender);
4244
let node_b_balance = node_b_pj_sender.list_balances();

0 commit comments

Comments
 (0)