X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=lightning%2Fsrc%2Fln%2Fchanmon_update_fail_tests.rs;h=f16875252428499fe2122e90e28c5cf57c866e30;hb=7a50154d87650c022610d7d65713322cbf6b8422;hp=ef7efdd221f028114e780aba62b5ea6e56bd90e7;hpb=bee42b1659c5989516e5d76501b85b9ff970c647;p=rust-lightning diff --git a/lightning/src/ln/chanmon_update_fail_tests.rs b/lightning/src/ln/chanmon_update_fail_tests.rs index ef7efdd2..f1687525 100644 --- a/lightning/src/ln/chanmon_update_fail_tests.rs +++ b/lightning/src/ln/chanmon_update_fail_tests.rs @@ -16,29 +16,29 @@ use bitcoin::blockdata::block::{Block, BlockHeader}; use bitcoin::blockdata::constants::genesis_block; use bitcoin::hash_types::BlockHash; use bitcoin::network::constants::Network; -use chain::channelmonitor::{ANTI_REORG_DELAY, ChannelMonitor}; -use chain::transaction::OutPoint; -use chain::{ChannelMonitorUpdateStatus, Listen, Watch}; -use ln::channelmanager::{self, ChannelManager, ChannelManagerReadArgs, RAACommitmentOrder, PaymentSendFailure}; -use ln::channel::AnnouncementSigsState; -use ln::msgs; -use ln::msgs::{ChannelMessageHandler, RoutingMessageHandler}; -use util::config::UserConfig; -use util::enforcing_trait_impls::EnforcingSigner; -use util::events::{Event, MessageSendEvent, MessageSendEventsProvider, PaymentPurpose, ClosureReason, HTLCDestination}; -use util::errors::APIError; -use util::ser::{ReadableArgs, Writeable}; -use util::test_utils::TestBroadcaster; - -use ln::functional_test_utils::*; - -use util::test_utils; - -use io; +use crate::chain::channelmonitor::{ANTI_REORG_DELAY, ChannelMonitor}; +use crate::chain::transaction::OutPoint; +use crate::chain::{ChannelMonitorUpdateStatus, Listen, Watch}; +use crate::ln::channelmanager::{self, ChannelManager, ChannelManagerReadArgs, RAACommitmentOrder, PaymentSendFailure}; +use crate::ln::channel::AnnouncementSigsState; +use crate::ln::msgs; +use crate::ln::msgs::{ChannelMessageHandler, RoutingMessageHandler}; +use crate::util::config::UserConfig; +use crate::util::enforcing_trait_impls::EnforcingSigner; +use crate::util::events::{Event, MessageSendEvent, MessageSendEventsProvider, PaymentPurpose, ClosureReason, HTLCDestination}; +use crate::util::errors::APIError; +use crate::util::ser::{ReadableArgs, Writeable}; +use crate::util::test_utils::TestBroadcaster; + +use crate::ln::functional_test_utils::*; + +use crate::util::test_utils; + +use crate::io; use bitcoin::hashes::Hash; use bitcoin::TxMerkleNode; -use prelude::*; -use sync::{Arc, Mutex}; +use crate::prelude::*; +use crate::sync::{Arc, Mutex}; #[test] fn test_simple_monitor_permanent_update_fail() { @@ -2238,11 +2238,12 @@ fn do_channel_holding_cell_serialize(disconnect: bool, reload_a: bool) { let (route, payment_hash_1, payment_preimage_1, payment_secret_1) = get_route_and_payment_hash!(&nodes[0], nodes[1], 100000); let (payment_preimage_2, payment_hash_2, payment_secret_2) = get_payment_preimage_hash!(&nodes[1]); - // Do a really complicated dance to get an HTLC into the holding cell, with MonitorUpdateFailed - // set but AwaitingRemoteRevoke unset. When this test was written, any attempts to send an HTLC - // while MonitorUpdateFailed is set are immediately failed-backwards. Thus, the only way to get - // an AddHTLC into the holding cell is to add it while AwaitingRemoteRevoke is set but - // MonitorUpdateFailed is unset, and then swap the flags. + // Do a really complicated dance to get an HTLC into the holding cell, with + // MonitorUpdateInProgress set but AwaitingRemoteRevoke unset. When this test was written, any + // attempts to send an HTLC while MonitorUpdateInProgress is set are immediately + // failed-backwards. Thus, the only way to get an AddHTLC into the holding cell is to add it + // while AwaitingRemoteRevoke is set but MonitorUpdateInProgress is unset, and then swap the + // flags. // // We do this by: // a) routing a payment from node B to node A, @@ -2255,8 +2256,8 @@ fn do_channel_holding_cell_serialize(disconnect: bool, reload_a: bool) { // e) delivering A's commitment_signed from (b) and the resulting B revoke_and_ack message, // clearing AwaitingRemoteRevoke on node A. // - // Note that because, at the end, MonitorUpdateFailed is still set, the HTLC generated in (c) - // will not be freed from the holding cell. + // Note that because, at the end, MonitorUpdateInProgress is still set, the HTLC generated in + // (c) will not be freed from the holding cell. let (payment_preimage_0, payment_hash_0, _) = route_payment(&nodes[1], &[&nodes[0]], 100_000); nodes[0].node.send_payment(&route, payment_hash_1, &Some(payment_secret_1)).unwrap();