X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fchannel.rs;h=65fb9919760e94e7fd65e07fb31b02dcc2cb72e9;hb=741cffc04ca6ac638f858c8d16065a26e26a20d5;hp=c9eebf41eb4706b3a7d39c10600c92e7c8e8949e;hpb=d4ad57b7e65f206bc40989eaef7ce2efe9428935;p=rust-lightning diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index c9eebf41..65fb9919 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -35,6 +35,9 @@ use std::default::Default; use std::{cmp,mem,fmt}; use std::ops::Deref; +#[cfg(all(test, feature = "mutation_testing"))] +use mutagen::mutate; + #[cfg(test)] pub struct ChannelValueStat { pub value_to_self_msat: u64, @@ -2357,6 +2360,7 @@ impl Channel { } } + #[cfg_attr(all(test, feature = "mutation_testing"), mutate)] /// Removes any uncommitted HTLCs, to be used on peer disconnection, including any pending /// HTLCs that we intended to add but haven't as we were waiting on a remote revoke. /// Returns the set of PendingHTLCStatuses from remote uncommitted HTLCs (which we're @@ -2443,6 +2447,7 @@ impl Channel { self.channel_state |= ChannelState::MonitorUpdateFailed as u32; } + #[cfg_attr(all(test, feature = "mutation_testing"), mutate)] /// Indicates that the latest ChannelMonitor update has been committed by the client /// successfully and we should restore normal operation. Returns messages which should be sent /// to the remote side. @@ -2513,6 +2518,7 @@ impl Channel { Ok(()) } + #[cfg_attr(all(test, feature = "mutation_testing"), mutate)] fn get_last_revoke_and_ack(&self) -> msgs::RevokeAndACK { let next_per_commitment_point = PublicKey::from_secret_key(&self.secp_ctx, &self.build_local_commitment_secret(self.cur_local_commitment_transaction_number)); let per_commitment_secret = chan_utils::build_commitment_secret(self.local_keys.commitment_seed(), self.cur_local_commitment_transaction_number + 2);