Add payment_hash to PaymentSent #999
[rust-lightning] / lightning / src / ln / reorg_tests.rs
index bbdb5bfac6bae9270e30bb99434c818020a3d475..494561733336be5a44cc76fed49393a873bc56b3 100644 (file)
 use chain::channelmonitor::{ANTI_REORG_DELAY, ChannelMonitor};
 use chain::transaction::OutPoint;
 use chain::{Confirm, Watch};
+use ln::PaymentHash;
 use ln::channelmanager::{ChannelManager, ChannelManagerReadArgs};
 use ln::features::InitFeatures;
-use ln::msgs::{ChannelMessageHandler, ErrorAction, HTLCFailChannelUpdate};
+use ln::msgs::{ChannelMessageHandler, ErrorAction};
+use routing::network_graph::NetworkUpdate;
 use util::enforcing_trait_impls::EnforcingSigner;
 use util::events::{Event, MessageSendEvent, MessageSendEventsProvider};
 use util::test_utils;
@@ -23,6 +25,8 @@ use util::ser::{ReadableArgs, Writeable};
 use bitcoin::blockdata::block::{Block, BlockHeader};
 use bitcoin::blockdata::script::Builder;
 use bitcoin::blockdata::opcodes;
+use bitcoin::hashes::sha256::Hash as Sha256;
+use bitcoin::hashes::Hash;
 use bitcoin::hash_types::BlockHash;
 use bitcoin::secp256k1::Secp256k1;
 
@@ -163,12 +167,7 @@ fn do_test_onchain_htlc_reorg(local_commitment: bool, claim: bool) {
        if claim {
                expect_payment_sent!(nodes[0], our_payment_preimage);
        } else {
-               let events = nodes[0].node.get_and_clear_pending_msg_events();
-               assert_eq!(events.len(), 1);
-               if let MessageSendEvent::PaymentFailureNetworkUpdate { update: HTLCFailChannelUpdate::ChannelClosed { ref is_permanent, .. } } = events[0] {
-                       assert!(is_permanent);
-               } else { panic!("Unexpected event!"); }
-               expect_payment_failed!(nodes[0], our_payment_hash, false);
+               expect_payment_failed_with_update!(nodes[0], our_payment_hash, false, chan_2.0.contents.short_channel_id, true);
        }
 }