Skip to content

Commit 451464b

Browse files
committed
Complete but PaymentPathFailed event instead of PaymentSent
1 parent cfe94ef commit 451464b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lightning/src/ln/offers_tests.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use crate::blinded_path::message::BlindedMessagePath;
4848
use crate::blinded_path::payment::{Bolt12OfferContext, Bolt12RefundContext, PaymentContext};
4949
use crate::blinded_path::message::{MessageContext, OffersContext};
5050
use crate::events::{ClosureReason, Event, MessageSendEventsProvider, PaymentFailureReason, PaymentPurpose};
51-
use crate::ln::channelmanager::{Bolt12PaymentError, MAX_SHORT_LIVED_RELATIVE_EXPIRY, PaymentId, RecentPaymentDetails, Retry, self};
51+
use crate::ln::channelmanager::{self, Bolt12PaymentError, PaymentId, RecentPaymentDetails, Retry, MAX_SHORT_LIVED_RELATIVE_EXPIRY};
5252
use crate::types::features::Bolt12InvoiceFeatures;
5353
use crate::ln::functional_test_utils::*;
5454
use crate::ln::msgs::{ChannelMessageHandler, Init, NodeAnnouncement, OnionMessage, OnionMessageHandler, RoutingMessageHandler, SocketAddress, UnsignedGossipMessage, UnsignedNodeAnnouncement};
@@ -2344,6 +2344,9 @@ fn no_double_pay_with_stale_channelmanager() {
23442344

23452345
// Claim payment on chain
23462346

2347+
let commitment_tx_0 = get_local_commitment_txn!(nodes[1], chan_id_0);
2348+
let commitment_tx_1 = get_local_commitment_txn!(nodes[1], chan_id_1);
2349+
23472350
// First close the channel between bob and alice, from bob's side
23482351
let error_message = "Channel force-closed";
23492352
nodes[1].node.force_close_broadcasting_latest_txn(&chan_id_0, &alice_id, error_message.to_string()).unwrap();
@@ -2356,4 +2359,19 @@ fn no_double_pay_with_stale_channelmanager() {
23562359
nodes[1].node.claim_funds(payment_preimage);
23572360
expect_payment_claimed!(nodes[1], payment_hash, amt_msat);
23582361
check_added_monitors!(nodes[1], 2);
2362+
2363+
let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0);
2364+
assert_eq!(node_txn.len(), 2);
2365+
2366+
connect_block(&nodes[0], &create_dummy_block(nodes[0].best_block_hash(), 42, vec![commitment_tx_0[0].clone(), node_txn[0].clone()]));
2367+
connect_block(&nodes[0], &create_dummy_block(nodes[0].best_block_hash(), 42, vec![commitment_tx_1[0].clone(), node_txn[1].clone()]));
2368+
connect_blocks(&nodes[0], TEST_FINAL_CLTV as u32);
2369+
2370+
let events = nodes[0].node.get_and_clear_pending_events();
2371+
2372+
match events[0] {
2373+
Event::PaymentSent { .. } => {},
2374+
Event::PaymentPathFailed { .. } => panic!("Received PaymentPathFailed"),
2375+
_ => panic!("Unexpected event")
2376+
}
23592377
}

0 commit comments

Comments
 (0)