use bitcoin::util::hash::{BitcoinHash, Sha256dHash};
use bitcoin::util::bip143;
+ use bitcoin::util::address::Address;
+ use bitcoin::util::bip32::{ChildNumber, ExtendedPubKey, ExtendedPrivKey};
use bitcoin::blockdata::block::{Block, BlockHeader};
use bitcoin::blockdata::transaction::{Transaction, TxOut, TxIn, SigHashType};
use bitcoin::blockdata::script::{Builder, Script};
} else { panic!("Unexpected result"); }
}
- macro_rules! check_dynamic_output {
+ macro_rules! check_dynamic_output_p2wsh {
($node: expr) => {
{
let events = $node.chan_monitor.simple_monitor.get_and_clear_pending_events();
Event::SpendableOutputs { ref outputs } => {
for outp in outputs {
match *outp {
- SpendableOutputDescriptor::DynamicOutput { ref outpoint, ref local_delayedkey, ref witness_script, ref to_self_delay, ref output } => {
+ SpendableOutputDescriptor::DynamicOutputP2WSH { ref outpoint, ref key, ref witness_script, ref to_self_delay, ref output } => {
let input = TxIn {
previous_output: outpoint.clone(),
script_sig: Script::new(),
input: vec![input],
output: vec![outp],
};
- let sighash = Message::from_slice(&bip143::SighashComponents::new(&spend_tx).sighash_all(&spend_tx.input[0], witness_script, output.value)[..]).unwrap();
let secp_ctx = Secp256k1::new();
- let local_delaysig = secp_ctx.sign(&sighash, local_delayedkey);
+ let sighash = Message::from_slice(&bip143::SighashComponents::new(&spend_tx).sighash_all(&spend_tx.input[0], witness_script, output.value)[..]).unwrap();
+ let local_delaysig = secp_ctx.sign(&sighash, key);
spend_tx.input[0].witness.push(local_delaysig.serialize_der(&secp_ctx).to_vec());
spend_tx.input[0].witness[0].push(SigHashType::All as u8);
spend_tx.input[0].witness.push(vec!(0));
}
}
+ macro_rules! check_dynamic_output_p2wpkh {
+ ($node: expr) => {
+ {
+ let events = $node.chan_monitor.simple_monitor.get_and_clear_pending_events();
+ let mut txn = Vec::new();
+ for event in events {
+ match event {
+ Event::SpendableOutputs { ref outputs } => {
+ for outp in outputs {
+ match *outp {
+ SpendableOutputDescriptor::DynamicOutputP2WPKH { ref outpoint, ref key, ref output } => {
+ let input = TxIn {
+ previous_output: outpoint.clone(),
+ script_sig: Script::new(),
+ sequence: 0,
+ witness: Vec::new(),
+ };
+ let outp = TxOut {
+ script_pubkey: Builder::new().push_opcode(opcodes::All::OP_RETURN).into_script(),
+ value: output.value,
+ };
+ let mut spend_tx = Transaction {
+ version: 2,
+ lock_time: 0,
+ input: vec![input],
+ output: vec![outp],
+ };
+ let secp_ctx = Secp256k1::new();
+ let remotepubkey = PublicKey::from_secret_key(&secp_ctx, &key);
+ let witness_script = Address::p2pkh(&remotepubkey, Network::Testnet).script_pubkey();
+ let sighash = Message::from_slice(&bip143::SighashComponents::new(&spend_tx).sighash_all(&spend_tx.input[0], &witness_script, output.value)[..]).unwrap();
+ let remotesig = secp_ctx.sign(&sighash, key);
+ spend_tx.input[0].witness.push(remotesig.serialize_der(&secp_ctx).to_vec());
+ spend_tx.input[0].witness[0].push(SigHashType::All as u8);
+ spend_tx.input[0].witness.push(remotepubkey.serialize().to_vec());
+ txn.push(spend_tx);
+ },
+ _ => panic!("Unexpected event"),
+ }
+ }
+ },
+ _ => panic!("Unexpected event"),
+ };
+ }
+ txn
+ }
+ }
+ }
+
+ macro_rules! check_static_output {
+ ($event: expr, $node: expr, $event_idx: expr, $output_idx: expr, $der_idx: expr, $idx_node: expr) => {
+ match $event[$event_idx] {
+ Event::SpendableOutputs { ref outputs } => {
+ match outputs[$output_idx] {
+ SpendableOutputDescriptor::StaticOutput { ref outpoint, ref output } => {
+ let secp_ctx = Secp256k1::new();
+ let input = TxIn {
+ previous_output: outpoint.clone(),
+ script_sig: Script::new(),
+ sequence: 0,
+ witness: Vec::new(),
+ };
+ let outp = TxOut {
+ script_pubkey: Builder::new().push_opcode(opcodes::All::OP_RETURN).into_script(),
+ value: output.value,
+ };
+ let mut spend_tx = Transaction {
+ version: 2,
+ lock_time: 0,
+ input: vec![input],
+ output: vec![outp.clone()],
+ };
+ let secret = {
+ match ExtendedPrivKey::new_master(&secp_ctx, Network::Testnet, &$node[$idx_node].node_seed) {
+ Ok(master_key) => {
+ match master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx($der_idx)) {
+ Ok(key) => key,
+ Err(_) => panic!("Your RNG is busted"),
+ }
+ }
+ Err(_) => panic!("Your rng is busted"),
+ }
+ };
+ let pubkey = ExtendedPubKey::from_private(&secp_ctx, &secret).public_key;
+ let witness_script = Address::p2pkh(&pubkey, Network::Testnet).script_pubkey();
+ let sighash = Message::from_slice(&bip143::SighashComponents::new(&spend_tx).sighash_all(&spend_tx.input[0], &witness_script, output.value)[..]).unwrap();
+ let sig = secp_ctx.sign(&sighash, &secret.secret_key);
+ spend_tx.input[0].witness.push(sig.serialize_der(&secp_ctx).to_vec());
+ spend_tx.input[0].witness[0].push(SigHashType::All as u8);
+ spend_tx.input[0].witness.push(pubkey.serialize().to_vec());
+ spend_tx
+ },
+ _ => panic!("Unexpected event !"),
+ }
+ },
+ _ => panic!("Unexpected event !"),
+ };
+ }
+ }
+
#[test]
fn test_claim_sizeable_push_msat() {
// Incidentally test SpendableOutput event generation due to detection of to_local output on commitment tx
let header = BlockHeader { version: 0x20000000, prev_blockhash: Default::default(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
nodes[1].chain_monitor.block_connected_with_filtering(&Block { header, txdata: vec![node_txn[0].clone()] }, 0);
- let spend_txn = check_dynamic_output!(nodes[1]);
+ let spend_txn = check_dynamic_output_p2wsh!(nodes[1]);
assert_eq!(spend_txn.len(), 1);
check_spends!(spend_txn[0], node_txn[0].clone());
}
+
+ #[test]
+ fn test_static_spendable_outputs_preimage_tx() {
+ let nodes = create_network(2);
+
+ // Create some initial channels
+ let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1);
+
+ let payment_preimage = route_payment(&nodes[0], &vec!(&nodes[1])[..], 3000000).0;
+
+ let commitment_tx = nodes[0].node.channel_state.lock().unwrap().by_id.get(&chan_1.2).unwrap().last_local_commitment_txn.clone();
+ assert_eq!(commitment_tx[0].input.len(), 1);
+ assert_eq!(commitment_tx[0].input[0].previous_output.txid, chan_1.3.txid());
+
+ // Settle A's commitment tx on B's chain
+ let header = BlockHeader { version: 0x20000000, prev_blockhash: Default::default(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
+ assert!(nodes[1].node.claim_funds(payment_preimage));
+ check_added_monitors!(nodes[1], 1);
+ nodes[1].chain_monitor.block_connected_with_filtering(&Block { header, txdata: vec![commitment_tx[0].clone()] }, 1);
+ let events = nodes[1].node.get_and_clear_pending_msg_events();
+ match events[0] {
+ MessageSendEvent::UpdateHTLCs { .. } => {},
+ _ => panic!("Unexpected event"),
+ }
+ match events[1] {
+ MessageSendEvent::BroadcastChannelUpdate { .. } => {},
+ _ => panic!("Unexepected event"),
+ }
+
+ // Check B's monitor was able to send back output descriptor event for preimage tx on A's commitment tx
+ let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap(); // ChannelManager : 1 (local commitment tx), ChannelMonitor: 2 (1 preimage tx) * 2 (block-rescan)
+ check_spends!(node_txn[0], commitment_tx[0].clone());
+ assert_eq!(node_txn[0], node_txn[2]);
+ assert_eq!(node_txn[0].input[0].witness.last().unwrap().len(), 133);
+ check_spends!(node_txn[1], chan_1.3.clone());
+
+ let events = nodes[1].chan_monitor.simple_monitor.get_and_clear_pending_events();
+ let spend_tx = check_static_output!(events, nodes, 0, 0, 1, 1);
+ check_spends!(spend_tx, node_txn[0].clone());
+ }
}
revocation_base_key: SecretKey,
htlc_base_key: SecretKey,
delayed_payment_base_key: SecretKey,
+ payment_base_key: SecretKey,
prev_latest_per_commitment_point: Option<PublicKey>,
latest_per_commitment_point: Option<PublicKey>,
},
}
impl ChannelMonitor {
- pub(super) fn new(revocation_base_key: &SecretKey, delayed_payment_base_key: &SecretKey, htlc_base_key: &SecretKey, our_to_self_delay: u16, destination_script: Script, logger: Arc<Logger>) -> ChannelMonitor {
+ pub(super) fn new(revocation_base_key: &SecretKey, delayed_payment_base_key: &SecretKey, htlc_base_key: &SecretKey, payment_base_key: &SecretKey, our_to_self_delay: u16, destination_script: Script, logger: Arc<Logger>) -> ChannelMonitor {
ChannelMonitor {
funding_txo: None,
commitment_transaction_number_obscure_factor: 0,
revocation_base_key: revocation_base_key.clone(),
htlc_base_key: htlc_base_key.clone(),
delayed_payment_base_key: delayed_payment_base_key.clone(),
+ payment_base_key: payment_base_key.clone(),
prev_latest_per_commitment_point: None,
latest_per_commitment_point: None,
},
feerate_per_kw,
htlc_outputs,
});
- self.key_storage = if let KeyStorage::PrivMode { ref revocation_base_key, ref htlc_base_key, ref delayed_payment_base_key, prev_latest_per_commitment_point: _, ref latest_per_commitment_point } = self.key_storage {
+ self.key_storage = if let KeyStorage::PrivMode { ref revocation_base_key, ref htlc_base_key, ref delayed_payment_base_key, ref payment_base_key, ref latest_per_commitment_point, .. } = self.key_storage {
KeyStorage::PrivMode {
revocation_base_key: *revocation_base_key,
htlc_base_key: *htlc_base_key,
delayed_payment_base_key: *delayed_payment_base_key,
+ payment_base_key: *payment_base_key,
prev_latest_per_commitment_point: *latest_per_commitment_point,
latest_per_commitment_point: Some(local_keys.per_commitment_point),
}
U48(self.commitment_transaction_number_obscure_factor).write(writer)?;
match self.key_storage {
- KeyStorage::PrivMode { ref revocation_base_key, ref htlc_base_key, ref delayed_payment_base_key, ref prev_latest_per_commitment_point, ref latest_per_commitment_point } => {
+ KeyStorage::PrivMode { ref revocation_base_key, ref htlc_base_key, ref delayed_payment_base_key, ref payment_base_key, ref prev_latest_per_commitment_point, ref latest_per_commitment_point } => {
writer.write_all(&[0; 1])?;
writer.write_all(&revocation_base_key[..])?;
writer.write_all(&htlc_base_key[..])?;
writer.write_all(&delayed_payment_base_key[..])?;
+ writer.write_all(&payment_base_key[..])?;
if let Some(ref prev_latest_per_commitment_point) = *prev_latest_per_commitment_point {
writer.write_all(&[1; 1])?;
writer.write_all(&prev_latest_per_commitment_point.serialize())?;
htlc_idxs.push(None);
values.push(outp.value);
total_value += outp.value;
- break; // There can only be one of these
+ } else if outp.script_pubkey.is_v0_p2wpkh() {
+ match self.key_storage {
+ KeyStorage::PrivMode { ref payment_base_key, .. } => {
+ let per_commitment_point = PublicKey::from_secret_key(&self.secp_ctx, &per_commitment_key);
+ if let Ok(local_key) = chan_utils::derive_private_key(&self.secp_ctx, &per_commitment_point, &payment_base_key) {
+ spendable_outputs.push(SpendableOutputDescriptor::DynamicOutputP2WPKH {
+ outpoint: BitcoinOutPoint { txid: commitment_txid, vout: idx as u32 },
+ key: local_key,
+ output: outp.clone(),
+ });
+ }
+ }
+ KeyStorage::SigsMode { .. } => {
+ //TODO: we need to ensure an offline client will generate the event when it
+ // cames back online after only the watchtower saw the transaction
+ }
+ }
}
}
Some(their_htlc_base_key) => ignore_error!(chan_utils::derive_public_key(&self.secp_ctx, revocation_point, &their_htlc_base_key)),
};
+
+ for (idx, outp) in tx.output.iter().enumerate() {
+ if outp.script_pubkey.is_v0_p2wpkh() {
+ match self.key_storage {
+ KeyStorage::PrivMode { ref payment_base_key, .. } => {
+ if let Ok(local_key) = chan_utils::derive_private_key(&self.secp_ctx, &revocation_point, &payment_base_key) {
+ spendable_outputs.push(SpendableOutputDescriptor::DynamicOutputP2WPKH {
+ outpoint: BitcoinOutPoint { txid: commitment_txid, vout: idx as u32 },
+ key: local_key,
+ output: outp.clone(),
+ });
+ }
+ }
+ KeyStorage::SigsMode { .. } => {
+ //TODO: we need to ensure an offline client will generate the event when it
+ // cames back online after only the watchtower saw the transaction
+ }
+ }
+ break; // Only to_remote ouput is claimable
+ }
+ }
+
let mut total_value = 0;
let mut values = Vec::new();
let mut inputs = Vec::new();
if let Some(ref per_commitment_point) = *per_commitment_point {
if let Some(ref delayed_payment_base_key) = *delayed_payment_base_key {
if let Ok(local_delayedkey) = chan_utils::derive_private_key(&self.secp_ctx, per_commitment_point, delayed_payment_base_key) {
- spendable_outputs.push(SpendableOutputDescriptor::DynamicOutput {
+ spendable_outputs.push(SpendableOutputDescriptor::DynamicOutputP2WSH {
outpoint: BitcoinOutPoint { txid: $father_tx.txid(), vout: $vout },
- local_delayedkey,
+ key: local_delayedkey,
witness_script: chan_utils::get_revokeable_redeemscript(&local_tx.revocation_key, self.our_to_self_delay, &local_tx.delayed_payment_key),
to_self_delay: self.our_to_self_delay,
output: $father_tx.output[$vout as usize].clone(),
if let &Some(ref local_tx) = &self.current_local_signed_commitment_tx {
if local_tx.txid == commitment_txid {
match self.key_storage {
- KeyStorage::PrivMode { revocation_base_key: _, htlc_base_key: _, ref delayed_payment_base_key, prev_latest_per_commitment_point: _, ref latest_per_commitment_point } => {
+ KeyStorage::PrivMode { ref delayed_payment_base_key, ref latest_per_commitment_point, .. } => {
return self.broadcast_by_local_state(local_tx, latest_per_commitment_point, &Some(*delayed_payment_base_key));
},
KeyStorage::SigsMode { .. } => {
if let &Some(ref local_tx) = &self.prev_local_signed_commitment_tx {
if local_tx.txid == commitment_txid {
match self.key_storage {
- KeyStorage::PrivMode { revocation_base_key: _, htlc_base_key: _, ref delayed_payment_base_key, ref prev_latest_per_commitment_point, .. } => {
+ KeyStorage::PrivMode { ref delayed_payment_base_key, ref prev_latest_per_commitment_point, .. } => {
return self.broadcast_by_local_state(local_tx, prev_latest_per_commitment_point, &Some(*delayed_payment_base_key));
},
KeyStorage::SigsMode { .. } => {
if self.would_broadcast_at_height(height) {
broadcaster.broadcast_transaction(&cur_local_tx.tx);
match self.key_storage {
- KeyStorage::PrivMode { revocation_base_key: _, htlc_base_key: _, ref delayed_payment_base_key, prev_latest_per_commitment_point: _, ref latest_per_commitment_point } => {
+ KeyStorage::PrivMode { ref delayed_payment_base_key, ref latest_per_commitment_point, .. } => {
let (txs, mut outputs) = self.broadcast_by_local_state(&cur_local_tx, latest_per_commitment_point, &Some(*delayed_payment_base_key));
spendable_outputs.append(&mut outputs);
for tx in txs {
let revocation_base_key = Readable::read(reader)?;
let htlc_base_key = Readable::read(reader)?;
let delayed_payment_base_key = Readable::read(reader)?;
+ let payment_base_key = Readable::read(reader)?;
let prev_latest_per_commitment_point = match <u8 as Readable<R>>::read(reader)? {
0 => None,
1 => Some(Readable::read(reader)?),
revocation_base_key,
htlc_base_key,
delayed_payment_base_key,
+ payment_base_key,
prev_latest_per_commitment_point,
latest_per_commitment_point,
}
{
// insert_secret correct sequence
- monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
+ monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
secrets.clear();
secrets.push([0; 32]);
{
// insert_secret #1 incorrect
- monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
+ monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
secrets.clear();
secrets.push([0; 32]);
{
// insert_secret #2 incorrect (#1 derived from incorrect)
- monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
+ monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
secrets.clear();
secrets.push([0; 32]);
{
// insert_secret #3 incorrect
- monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
+ monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
secrets.clear();
secrets.push([0; 32]);
{
// insert_secret #4 incorrect (1,2,3 derived from incorrect)
- monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
+ monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
secrets.clear();
secrets.push([0; 32]);
{
// insert_secret #5 incorrect
- monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
+ monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
secrets.clear();
secrets.push([0; 32]);
{
// insert_secret #6 incorrect (5 derived from incorrect)
- monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
+ monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
secrets.clear();
secrets.push([0; 32]);
{
// insert_secret #7 incorrect
- monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
+ monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
secrets.clear();
secrets.push([0; 32]);
{
// insert_secret #8 incorrect
- monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
+ monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
secrets.clear();
secrets.push([0; 32]);
// Prune with one old state and a local commitment tx holding a few overlaps with the
// old state.
- let mut monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
+ let mut monitor = ChannelMonitor::new(&SecretKey::from_slice(&secp_ctx, &[42; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[43; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), &SecretKey::from_slice(&secp_ctx, &[44; 32]).unwrap(), 0, Script::new(), logger.clone());
monitor.set_their_to_self_delay(10);
monitor.provide_latest_local_commitment_tx_info(dummy_tx.clone(), dummy_keys!(), 0, preimages_to_local_htlcs!(preimages[0..10]));