X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Freorg_tests.rs;h=efc07588be20f9cfc293ad12435bd2b3b82074db;hb=73bc0f61b912ab0617c77192328faedc4abf1502;hp=f5670f5c9d8ec8d1ad99216df612472dcaca0240;hpb=d17e759d021c90abcbc7b3b433943d29e3c60724;p=rust-lightning diff --git a/lightning/src/ln/reorg_tests.rs b/lightning/src/ln/reorg_tests.rs index f5670f5c..efc07588 100644 --- a/lightning/src/ln/reorg_tests.rs +++ b/lightning/src/ln/reorg_tests.rs @@ -15,6 +15,8 @@ use crate::chain::transaction::OutPoint; use crate::chain::Confirm; use crate::events::{Event, MessageSendEventsProvider, ClosureReason, HTLCDestination, MessageSendEvent}; use crate::ln::msgs::{ChannelMessageHandler, Init}; +use crate::ln::types::ChannelId; +use crate::sign::OutputSpender; use crate::util::test_utils; use crate::util::ser::Writeable; use crate::util::string::UntrustedString; @@ -25,7 +27,7 @@ use bitcoin::secp256k1::Secp256k1; use crate::prelude::*; -use crate::ln::{functional_test_utils::*, ChannelId}; +use crate::ln::functional_test_utils::*; fn do_test_onchain_htlc_reorg(local_commitment: bool, claim: bool) { // Our on-chain HTLC-claim learning has a few properties worth testing: @@ -198,7 +200,7 @@ fn test_counterparty_revoked_reorg() { let mut unrevoked_local_txn = get_local_commitment_txn!(nodes[0], chan.2); assert_eq!(unrevoked_local_txn.len(), 3); // commitment + 2 HTLC txn // Sort the unrevoked transactions in reverse order, ie commitment tx, then HTLC 1 then HTLC 3 - unrevoked_local_txn.sort_unstable_by_key(|tx| 1_000_000 - tx.output.iter().map(|outp| outp.value).sum::()); + unrevoked_local_txn.sort_unstable_by_key(|tx| 1_000_000 - tx.output.iter().map(|outp| outp.value.to_sat()).sum::()); // Now mine A's old commitment transaction, which should close the channel, but take no action // on any of the HTLCs, at least until we get six confirmations (which we won't get).