projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Construct from-message `HTLCFailReason` via a constructor method
[rust-lightning]
/
lightning
/
src
/
ln
/
chanmon_update_fail_tests.rs
diff --git
a/lightning/src/ln/chanmon_update_fail_tests.rs
b/lightning/src/ln/chanmon_update_fail_tests.rs
index e78b8999f7ec88c6047b5e5297c75a4b9d332fac..b1b6b79712dc75fad8ccd2e2a2126dc1cf3f9d16 100644
(file)
--- a/
lightning/src/ln/chanmon_update_fail_tests.rs
+++ b/
lightning/src/ln/chanmon_update_fail_tests.rs
@@
-200,9
+200,11
@@
fn do_test_simple_monitor_temporary_update_fail(disconnect: bool) {
let events_3 = nodes[1].node.get_and_clear_pending_events();
assert_eq!(events_3.len(), 1);
match events_3[0] {
let events_3 = nodes[1].node.get_and_clear_pending_events();
assert_eq!(events_3.len(), 1);
match events_3[0] {
- Event::PaymentReceived { ref payment_hash, ref purpose, amount_msat } => {
+ Event::PaymentReceived { ref payment_hash, ref purpose, amount_msat
, receiver_node_id, via_channel_id, via_user_channel_id: _
} => {
assert_eq!(payment_hash_1, *payment_hash);
assert_eq!(amount_msat, 1_000_000);
assert_eq!(payment_hash_1, *payment_hash);
assert_eq!(amount_msat, 1_000_000);
+ assert_eq!(receiver_node_id.unwrap(), nodes[1].node.get_our_node_id());
+ assert_eq!(via_channel_id, Some(channel_id));
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());
@@
-567,9
+569,11
@@
fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
let events_5 = nodes[1].node.get_and_clear_pending_events();
assert_eq!(events_5.len(), 1);
match events_5[0] {
let events_5 = nodes[1].node.get_and_clear_pending_events();
assert_eq!(events_5.len(), 1);
match events_5[0] {
- Event::PaymentReceived { ref payment_hash, ref purpose, amount_msat } => {
+ Event::PaymentReceived { ref payment_hash, ref purpose, amount_msat
, receiver_node_id, via_channel_id, via_user_channel_id: _
} => {
assert_eq!(payment_hash_2, *payment_hash);
assert_eq!(amount_msat, 1_000_000);
assert_eq!(payment_hash_2, *payment_hash);
assert_eq!(amount_msat, 1_000_000);
+ assert_eq!(receiver_node_id.unwrap(), nodes[1].node.get_our_node_id());
+ assert_eq!(via_channel_id, Some(channel_id));
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());
@@
-682,9
+686,11
@@
fn test_monitor_update_fail_cs() {
let events = nodes[1].node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
match events[0] {
let events = nodes[1].node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
match events[0] {
- Event::PaymentReceived { payment_hash, ref purpose, amount_msat } => {
+ Event::PaymentReceived { payment_hash, ref purpose, amount_msat
, receiver_node_id, via_channel_id, via_user_channel_id: _
} => {
assert_eq!(payment_hash, our_payment_hash);
assert_eq!(amount_msat, 1_000_000);
assert_eq!(payment_hash, our_payment_hash);
assert_eq!(amount_msat, 1_000_000);
+ assert_eq!(receiver_node_id.unwrap(), nodes[1].node.get_our_node_id());
+ assert_eq!(via_channel_id, Some(channel_id));
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());
@@
-1624,7
+1630,8
@@
fn test_monitor_update_fail_claim() {
commitment_signed_dance!(nodes[1], nodes[2], payment_event.commitment_msg, false, true);
// Now restore monitor updating on the 0<->1 channel and claim the funds on B.
commitment_signed_dance!(nodes[1], nodes[2], payment_event.commitment_msg, false, true);
// Now restore monitor updating on the 0<->1 channel and claim the funds on B.
- let (outpoint, latest_update, _) = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&chan_1.2).unwrap().clone();
+ let channel_id = chan_1.2;
+ let (outpoint, latest_update, _) = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&channel_id).unwrap().clone();
nodes[1].chain_monitor.chain_monitor.force_channel_monitor_updated(outpoint, latest_update);
check_added_monitors!(nodes[1], 0);
nodes[1].chain_monitor.chain_monitor.force_channel_monitor_updated(outpoint, latest_update);
check_added_monitors!(nodes[1], 0);
@@
-1645,9
+1652,12
@@
fn test_monitor_update_fail_claim() {
let events = nodes[0].node.get_and_clear_pending_events();
assert_eq!(events.len(), 2);
match events[0] {
let events = nodes[0].node.get_and_clear_pending_events();
assert_eq!(events.len(), 2);
match events[0] {
- Event::PaymentReceived { ref payment_hash, ref purpose, amount_msat } => {
+ Event::PaymentReceived { ref payment_hash, ref purpose, amount_msat
, receiver_node_id, via_channel_id, via_user_channel_id
} => {
assert_eq!(payment_hash_2, *payment_hash);
assert_eq!(1_000_000, amount_msat);
assert_eq!(payment_hash_2, *payment_hash);
assert_eq!(1_000_000, amount_msat);
+ assert_eq!(receiver_node_id.unwrap(), nodes[0].node.get_our_node_id());
+ assert_eq!(via_channel_id, Some(channel_id));
+ assert_eq!(via_user_channel_id, Some(42));
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());
@@
-1659,9
+1669,11
@@
fn test_monitor_update_fail_claim() {
_ => panic!("Unexpected event"),
}
match events[1] {
_ => panic!("Unexpected event"),
}
match events[1] {
- Event::PaymentReceived { ref payment_hash, ref purpose, amount_msat } => {
+ Event::PaymentReceived { ref payment_hash, ref purpose, amount_msat
, receiver_node_id, via_channel_id, via_user_channel_id: _
} => {
assert_eq!(payment_hash_3, *payment_hash);
assert_eq!(1_000_000, amount_msat);
assert_eq!(payment_hash_3, *payment_hash);
assert_eq!(1_000_000, amount_msat);
+ assert_eq!(receiver_node_id.unwrap(), nodes[0].node.get_our_node_id());
+ assert_eq!(via_channel_id, Some(channel_id));
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());