You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Channel and its corresponding ChannelMonitor keep track of the last
block connected. However, they are initialized with the default block
hash, which is a problem if the ChannelMonitor is serialized before a
block is connected. Instead, pass along ChannelManager's last block
hash, which is initialized with a "birthday" hash.
Copy file name to clipboardExpand all lines: fuzz/src/chanmon_consistency.rs
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@
19
19
//! channel being force-closed.
20
20
21
21
use bitcoin::blockdata::block::BlockHeader;
22
+
use bitcoin::blockdata::constants::genesis_block;
22
23
use bitcoin::blockdata::transaction::{Transaction,TxOut};
23
24
use bitcoin::blockdata::script::{Builder,Script};
24
25
use bitcoin::blockdata::opcodes;
@@ -35,7 +36,7 @@ use lightning::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdateErr,
35
36
use lightning::chain::transaction::OutPoint;
36
37
use lightning::chain::chaininterface::{BroadcasterInterface,ConfirmationTarget,FeeEstimator};
37
38
use lightning::chain::keysinterface::{KeysInterface,InMemorySigner};
38
-
use lightning::ln::channelmanager::{ChannelManager,PaymentHash,PaymentPreimage,PaymentSecret,PaymentSendFailure,ChannelManagerReadArgs};
39
+
use lightning::ln::channelmanager::{ChainParameters,ChannelManager,PaymentHash,PaymentPreimage,PaymentSecret,PaymentSendFailure,ChannelManagerReadArgs};
39
40
use lightning::ln::features::{ChannelFeatures,InitFeatures,NodeFeatures};
40
41
use lightning::ln::msgs::{CommitmentUpdate,ChannelMessageHandler,DecodeError,ErrorAction,UpdateAddHTLC,Init};
41
42
use lightning::util::enforcing_trait_impls::{EnforcingSigner,INITIAL_REVOKED_COMMITMENT_NUMBER};
let node_b_node_id = PublicKey::from_secret_key(&secp_ctx,&SecretKey::from_slice(&[7;32]).unwrap());
4823
-
let node_b_chan = Channel::<EnforcingSigner>::new_from_req(&&feeest,&&keys_provider, node_b_node_id,InitFeatures::known(),&open_channel_msg,7,&config).unwrap();
4824
+
let node_b_chan = Channel::<EnforcingSigner>::new_from_req(&&feeest,&&keys_provider, node_b_node_id,InitFeatures::known(),&open_channel_msg,7,&config, genesis_hash).unwrap();
let accept_channel_msg = node_b_chan.get_accept_channel();
@@ -5005,7 +5008,8 @@ mod tests {
5005
5008
let counterparty_node_id = PublicKey::from_secret_key(&secp_ctx,&SecretKey::from_slice(&[42;32]).unwrap());
5006
5009
letmut config = UserConfig::default();
5007
5010
config.channel_options.announced_channel = false;
5008
-
letmut chan = Channel::<InMemorySigner>::new_outbound(&&feeest,&&keys_provider, counterparty_node_id,10_000_000,100000,42,&config).unwrap();// Nothing uses their network key in this test
5011
+
let block_hash = genesis_block(Network::Testnet).header.block_hash();
5012
+
letmut chan = Channel::<InMemorySigner>::new_outbound(&&feeest,&&keys_provider, counterparty_node_id,10_000_000,100000,42,&config, block_hash).unwrap();// Nothing uses their network key in this test
5009
5013
chan.holder_dust_limit_satoshis = 546;
5010
5014
5011
5015
let funding_info = OutPoint{txid:Txid::from_hex("8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be").unwrap(),index:0};
APIError::APIMisuseError{ err } => {assert!(regex::Regex::new(r"Configured with an unreasonable our_to_self_delay \(\d+\) putting user funds at risks").unwrap().is_match(err.as_str()));},
ChannelError::Close(err) => {assert!(regex::Regex::new(r"Configured with an unreasonable our_to_self_delay \(\d+\) putting user funds at risks").unwrap().is_match(err.as_str()));},
ChannelError::Close(err) => {assert!(regex::Regex::new(r"They wanted our payments to be delayed by a needlessly long period\. Upper limit: \d+\. Actual: \d+").unwrap().is_match(err.as_str()));},
0 commit comments