X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Ffunctional_tests.rs;h=c07775c8785bfd24adbd1e1639ec37649845b283;hb=a332bfcdc25e26bae2f550dc3e3ce35d2343a032;hp=fac15fc5aaab9d17b429ae5ca8661fc03fb95918;hpb=15050895fd409ff8b01092dc2db30d8222063631;p=rust-lightning diff --git a/lightning/src/ln/functional_tests.rs b/lightning/src/ln/functional_tests.rs index fac15fc5..c07775c8 100644 --- a/lightning/src/ln/functional_tests.rs +++ b/lightning/src/ln/functional_tests.rs @@ -21,7 +21,7 @@ use crate::chain::keysinterface::{ChannelSigner, EcdsaChannelSigner, EntropySour use crate::events::{Event, MessageSendEvent, MessageSendEventsProvider, PathFailure, PaymentPurpose, ClosureReason, HTLCDestination, PaymentFailureReason}; use crate::ln::{PaymentPreimage, PaymentSecret, PaymentHash}; use crate::ln::channel::{commitment_tx_base_weight, COMMITMENT_TX_WEIGHT_PER_HTLC, CONCURRENT_INBOUND_HTLC_FEE_BUFFER, FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE, MIN_AFFORDABLE_HTLC_COUNT}; -use crate::ln::channelmanager::{self, PaymentId, RAACommitmentOrder, PaymentSendFailure, RecipientOnionFields, BREAKDOWN_TIMEOUT, MIN_CLTV_EXPIRY_DELTA}; +use crate::ln::channelmanager::{self, PaymentId, RAACommitmentOrder, PaymentSendFailure, RecipientOnionFields, BREAKDOWN_TIMEOUT, ENABLE_GOSSIP_TICKS, DISABLE_GOSSIP_TICKS, MIN_CLTV_EXPIRY_DELTA}; use crate::ln::channel::{Channel, ChannelError}; use crate::ln::{chan_utils, onion_utils}; use crate::ln::chan_utils::{OFFERED_HTLC_SCRIPT_WEIGHT, htlc_success_tx_weight, htlc_timeout_tx_weight, HTLCOutputInCommitment}; @@ -1107,7 +1107,7 @@ fn holding_cell_htlc_counting() { let chan_2 = create_announced_chan_between_nodes(&nodes, 1, 2); let mut payments = Vec::new(); - for _ in 0..crate::ln::channel::OUR_MAX_HTLCS { + for _ in 0..50 { let (route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash!(nodes[1], nodes[2], 100000); nodes[1].node.send_payment_with_route(&route, payment_hash, RecipientOnionFields::secret_only(payment_secret), PaymentId(payment_hash.0)).unwrap(); @@ -6270,11 +6270,11 @@ fn test_update_add_htlc_bolt2_receiver_check_max_htlc_limit() { onion_routing_packet: onion_packet.clone(), }; - for i in 0..super::channel::OUR_MAX_HTLCS { + for i in 0..50 { msg.htlc_id = i as u64; nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &msg); } - msg.htlc_id = (super::channel::OUR_MAX_HTLCS) as u64; + msg.htlc_id = (50) as u64; nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &msg); assert!(nodes[1].node.list_channels().is_empty()); @@ -7100,8 +7100,9 @@ fn test_announce_disable_channels() { nodes[0].node.peer_disconnected(&nodes[1].node.get_our_node_id()); nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id()); - nodes[0].node.timer_tick_occurred(); // Enabled -> DisabledStaged - nodes[0].node.timer_tick_occurred(); // DisabledStaged -> Disabled + for _ in 0..DISABLE_GOSSIP_TICKS + 1 { + nodes[0].node.timer_tick_occurred(); + } let msg_events = nodes[0].node.get_and_clear_pending_msg_events(); assert_eq!(msg_events.len(), 3); let mut chans_disabled = HashMap::new(); @@ -7141,7 +7142,9 @@ fn test_announce_disable_channels() { nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &reestablish_1[2]); handle_chan_reestablish_msgs!(nodes[1], nodes[0]); - nodes[0].node.timer_tick_occurred(); + for _ in 0..ENABLE_GOSSIP_TICKS { + nodes[0].node.timer_tick_occurred(); + } assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty()); nodes[0].node.timer_tick_occurred(); let msg_events = nodes[0].node.get_and_clear_pending_msg_events();