X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Fenforcing_trait_impls.rs;h=5d0a196f31fb27d956ae4c314dc302e243a0ae33;hb=5b7d7ed940d62b25a7056682184aa60c8d05b65e;hp=67c38dc7193263a5df4e5e02d1e4f50bd48df627;hpb=9a23130db94246df059cd6fa2b69a40796a52e1e;p=rust-lightning diff --git a/lightning/src/util/enforcing_trait_impls.rs b/lightning/src/util/enforcing_trait_impls.rs index 67c38dc7..5d0a196f 100644 --- a/lightning/src/util/enforcing_trait_impls.rs +++ b/lightning/src/util/enforcing_trait_impls.rs @@ -7,7 +7,7 @@ // You may not use this file except in accordance with one or both of these // licenses. -use ln::chan_utils::{HTLCOutputInCommitment, TxCreationKeys, ChannelPublicKeys, LocalCommitmentTransaction, PreCalculatedTxCreationKeys}; +use ln::chan_utils::{HTLCOutputInCommitment, TxCreationKeys, ChannelPublicKeys, HolderCommitmentTransaction, PreCalculatedTxCreationKeys}; use ln::{chan_utils, msgs}; use chain::keysinterface::{ChannelKeys, InMemoryChannelKeys}; @@ -87,29 +87,29 @@ impl ChannelKeys for EnforcingChannelKeys { Ok(self.inner.sign_counterparty_commitment(feerate_per_kw, commitment_tx, pre_keys, htlcs, secp_ctx).unwrap()) } - fn sign_holder_commitment(&self, holder_commitment_tx: &LocalCommitmentTransaction, secp_ctx: &Secp256k1) -> Result { + fn sign_holder_commitment(&self, holder_commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1) -> Result { // TODO: enforce the ChannelKeys contract - error if this commitment was already revoked // TODO: need the commitment number Ok(self.inner.sign_holder_commitment(holder_commitment_tx, secp_ctx).unwrap()) } #[cfg(any(test,feature = "unsafe_revoked_tx_signing"))] - fn unsafe_sign_holder_commitment(&self, holder_commitment_tx: &LocalCommitmentTransaction, secp_ctx: &Secp256k1) -> Result { + fn unsafe_sign_holder_commitment(&self, holder_commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1) -> Result { Ok(self.inner.unsafe_sign_holder_commitment(holder_commitment_tx, secp_ctx).unwrap()) } - fn sign_holder_commitment_htlc_transactions(&self, holder_commitment_tx: &LocalCommitmentTransaction, secp_ctx: &Secp256k1) -> Result>, ()> { + fn sign_holder_commitment_htlc_transactions(&self, holder_commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1) -> Result>, ()> { let commitment_txid = holder_commitment_tx.txid(); - let local_csv = self.inner.counterparty_selected_contest_delay(); + let holder_csv = self.inner.counterparty_selected_contest_delay(); for this_htlc in holder_commitment_tx.per_htlc.iter() { if this_htlc.0.transaction_output_index.is_some() { - let htlc_tx = chan_utils::build_htlc_transaction(&commitment_txid, holder_commitment_tx.feerate_per_kw, local_csv, &this_htlc.0, &holder_commitment_tx.local_keys.broadcaster_delayed_payment_key, &holder_commitment_tx.local_keys.revocation_key); + let htlc_tx = chan_utils::build_htlc_transaction(&commitment_txid, holder_commitment_tx.feerate_per_kw, holder_csv, &this_htlc.0, &holder_commitment_tx.keys.broadcaster_delayed_payment_key, &holder_commitment_tx.keys.revocation_key); - let htlc_redeemscript = chan_utils::get_htlc_redeemscript(&this_htlc.0, &holder_commitment_tx.local_keys); + let htlc_redeemscript = chan_utils::get_htlc_redeemscript(&this_htlc.0, &holder_commitment_tx.keys); let sighash = hash_to_message!(&bip143::SigHashCache::new(&htlc_tx).signature_hash(0, &htlc_redeemscript, this_htlc.0.amount_msat / 1000, SigHashType::All)[..]); - secp_ctx.verify(&sighash, this_htlc.1.as_ref().unwrap(), &holder_commitment_tx.local_keys.countersignatory_htlc_key).unwrap(); + secp_ctx.verify(&sighash, this_htlc.1.as_ref().unwrap(), &holder_commitment_tx.keys.countersignatory_htlc_key).unwrap(); } } @@ -132,8 +132,8 @@ impl ChannelKeys for EnforcingChannelKeys { self.inner.sign_channel_announcement(msg, secp_ctx) } - fn on_accept(&mut self, channel_pubkeys: &ChannelPublicKeys, remote_locally_selected_delay: u16, locally_selected_delay: u16) { - self.inner.on_accept(channel_pubkeys, remote_locally_selected_delay, locally_selected_delay) + fn on_accept(&mut self, channel_pubkeys: &ChannelPublicKeys, counterparty_selected_delay: u16, holder_selected_delay: u16) { + self.inner.on_accept(channel_pubkeys, counterparty_selected_delay, holder_selected_delay) } }