mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-03-13 14:52:21 +01:00
Rename various anchor methods which are now ambiguous
As we move towards zero-fee commitment transactions, we need to differentiate between the now-two-types of "anchor channels". We do so here by renaming a number of methods which refer to anchors as "keyed anchors" as the zero-fee commitment transaction anchors do not have a public key associated with them. We also drop `TaprootChannelSigner::sign_holder_anchor_input` as we are unlikely to support keyed anchors for taproot channels.
This commit is contained in:
parent
0faf17bbc6
commit
8527258380
9 changed files with 75 additions and 87 deletions
|
@ -5099,7 +5099,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
|
|||
{
|
||||
let payment_point = onchain_tx_handler.channel_transaction_parameters.holder_pubkeys.payment_point;
|
||||
counterparty_payment_script =
|
||||
chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point).to_p2wsh();
|
||||
chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&payment_point).to_p2wsh();
|
||||
}
|
||||
|
||||
let channel_id = channel_id.unwrap_or(ChannelId::v1_from_funding_outpoint(outpoint));
|
||||
|
|
|
@ -666,7 +666,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
|
|||
|
||||
// We'll locate an anchor output we can spend within the commitment transaction.
|
||||
let funding_pubkey = &self.channel_transaction_parameters.holder_pubkeys.funding_pubkey;
|
||||
match chan_utils::get_anchor_output(&tx.0, funding_pubkey) {
|
||||
match chan_utils::get_keyed_anchor_output(&tx.0, funding_pubkey) {
|
||||
// An anchor output was found, so we should yield a funding event externally.
|
||||
Some((idx, _)) => {
|
||||
// TODO: Use a lower confirmation target when both our and the
|
||||
|
|
|
@ -22,7 +22,7 @@ use crate::ln::types::ChannelId;
|
|||
use crate::ln::chan_utils;
|
||||
use crate::ln::chan_utils::{
|
||||
ANCHOR_INPUT_WITNESS_WEIGHT, HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT,
|
||||
HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT, HTLCOutputInCommitment
|
||||
HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT, HTLCOutputInCommitment, shared_anchor_script_pubkey,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use crate::sign::{
|
||||
|
@ -62,8 +62,17 @@ impl AnchorDescriptor {
|
|||
/// Returns the UTXO to be spent by the anchor input, which can be obtained via
|
||||
/// [`Self::unsigned_tx_input`].
|
||||
pub fn previous_utxo(&self) -> TxOut {
|
||||
let tx_params = &self.channel_derivation_parameters.transaction_parameters;
|
||||
let script_pubkey =
|
||||
if tx_params.channel_type_features.supports_anchors_zero_fee_htlc_tx() {
|
||||
let channel_params = tx_params.as_holder_broadcastable();
|
||||
chan_utils::get_keyed_anchor_redeemscript(&channel_params.broadcaster_pubkeys().funding_pubkey)
|
||||
} else {
|
||||
assert!(tx_params.channel_type_features.supports_anchor_zero_fee_commitments());
|
||||
shared_anchor_script_pubkey()
|
||||
};
|
||||
TxOut {
|
||||
script_pubkey: self.witness_script().to_p2wsh(),
|
||||
script_pubkey,
|
||||
value: Amount::from_sat(ANCHOR_OUTPUT_VALUE_SATOSHI),
|
||||
}
|
||||
}
|
||||
|
@ -79,17 +88,17 @@ impl AnchorDescriptor {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the witness script of the anchor output in the commitment transaction.
|
||||
pub fn witness_script(&self) -> ScriptBuf {
|
||||
let channel_params = self.channel_derivation_parameters.transaction_parameters.as_holder_broadcastable();
|
||||
chan_utils::get_anchor_redeemscript(&channel_params.broadcaster_pubkeys().funding_pubkey)
|
||||
}
|
||||
|
||||
/// Returns the fully signed witness required to spend the anchor output in the commitment
|
||||
/// transaction.
|
||||
pub fn tx_input_witness(&self, signature: &Signature) -> Witness {
|
||||
let channel_params = self.channel_derivation_parameters.transaction_parameters.as_holder_broadcastable();
|
||||
chan_utils::build_anchor_input_witness(&channel_params.broadcaster_pubkeys().funding_pubkey, signature)
|
||||
let tx_params = &self.channel_derivation_parameters.transaction_parameters;
|
||||
if tx_params.channel_type_features.supports_anchors_zero_fee_htlc_tx() {
|
||||
let channel_params = self.channel_derivation_parameters.transaction_parameters.as_holder_broadcastable();
|
||||
chan_utils::build_keyed_anchor_input_witness(&channel_params.broadcaster_pubkeys().funding_pubkey, signature)
|
||||
} else {
|
||||
debug_assert!(tx_params.channel_type_features.supports_anchor_zero_fee_commitments());
|
||||
Witness::from_slice(&[&[]])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,9 +120,9 @@ pub enum BumpTransactionEvent {
|
|||
/// The consumer should be able to sign for any of the additional inputs included within the
|
||||
/// child anchor transaction. To sign its anchor input, an [`EcdsaChannelSigner`] should be
|
||||
/// re-derived through [`SignerProvider::derive_channel_signer`]. The anchor input signature
|
||||
/// can be computed with [`EcdsaChannelSigner::sign_holder_anchor_input`], which can then be
|
||||
/// provided to [`build_anchor_input_witness`] along with the `funding_pubkey` to obtain the
|
||||
/// full witness required to spend.
|
||||
/// can be computed with [`EcdsaChannelSigner::sign_holder_keyed_anchor_input`], which can then
|
||||
/// be provided to [`build_keyed_anchor_input_witness`] along with the `funding_pubkey` to
|
||||
/// obtain the full witness required to spend.
|
||||
///
|
||||
/// It is possible to receive more than one instance of this event if a valid child anchor
|
||||
/// transaction is never broadcast or is but not with a sufficient fee to be mined. Care should
|
||||
|
@ -133,8 +142,8 @@ pub enum BumpTransactionEvent {
|
|||
/// be not urgent.
|
||||
///
|
||||
/// [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner
|
||||
/// [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_anchor_input
|
||||
/// [`build_anchor_input_witness`]: crate::ln::chan_utils::build_anchor_input_witness
|
||||
/// [`EcdsaChannelSigner::sign_holder_keyed_anchor_input`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_keyed_anchor_input
|
||||
/// [`build_keyed_anchor_input_witness`]: crate::ln::chan_utils::build_keyed_anchor_input_witness
|
||||
ChannelClose {
|
||||
/// The `channel_id` of the channel which has been closed.
|
||||
channel_id: ChannelId,
|
||||
|
@ -678,7 +687,7 @@ where
|
|||
|
||||
let signer = self.signer_provider.derive_channel_signer(anchor_descriptor.channel_derivation_parameters.keys_id);
|
||||
let channel_parameters = &anchor_descriptor.channel_derivation_parameters.transaction_parameters;
|
||||
let anchor_sig = signer.sign_holder_anchor_input(channel_parameters, &anchor_tx, 0, &self.secp)?;
|
||||
let anchor_sig = signer.sign_holder_keyed_anchor_input(channel_parameters, &anchor_tx, 0, &self.secp)?;
|
||||
anchor_tx.input[0].witness = anchor_descriptor.tx_input_witness(&anchor_sig);
|
||||
|
||||
#[cfg(debug_assertions)] {
|
||||
|
@ -850,6 +859,7 @@ mod tests {
|
|||
use crate::util::ser::Readable;
|
||||
use crate::util::test_utils::{TestBroadcaster, TestLogger};
|
||||
use crate::sign::KeysManager;
|
||||
use crate::types::features::ChannelTypeFeatures;
|
||||
|
||||
use bitcoin::hashes::Hash;
|
||||
use bitcoin::hex::FromHex;
|
||||
|
@ -934,6 +944,10 @@ mod tests {
|
|||
let logger = TestLogger::new();
|
||||
let handler = BumpTransactionEventHandler::new(&broadcaster, &source, &signer, &logger);
|
||||
|
||||
let mut transaction_parameters = ChannelTransactionParameters::test_dummy(42_000_000);
|
||||
transaction_parameters.channel_type_features =
|
||||
ChannelTypeFeatures::anchors_zero_htlc_fee_and_dependencies();
|
||||
|
||||
handler.handle_event(&BumpTransactionEvent::ChannelClose {
|
||||
channel_id: ChannelId([42; 32]),
|
||||
counterparty_node_id: PublicKey::from_slice(&[2; 33]).unwrap(),
|
||||
|
@ -945,7 +959,7 @@ mod tests {
|
|||
channel_derivation_parameters: ChannelDerivationParameters {
|
||||
value_satoshis: 42_000_000,
|
||||
keys_id: [42; 32],
|
||||
transaction_parameters: ChannelTransactionParameters::test_dummy(42_000_000),
|
||||
transaction_parameters,
|
||||
},
|
||||
outpoint: OutPoint { txid: Txid::from_byte_array([42; 32]), vout: 0 },
|
||||
},
|
||||
|
|
|
@ -574,7 +574,7 @@ pub fn get_revokeable_redeemscript(revocation_key: &RevocationKey, contest_delay
|
|||
/// the channel type.
|
||||
pub fn get_counterparty_payment_script(channel_type_features: &ChannelTypeFeatures, payment_key: &PublicKey) -> ScriptBuf {
|
||||
if channel_type_features.supports_anchors_zero_fee_htlc_tx() {
|
||||
get_to_countersignatory_with_anchors_redeemscript(payment_key).to_p2wsh()
|
||||
get_to_countersigner_keyed_anchor_redeemscript(payment_key).to_p2wsh()
|
||||
} else {
|
||||
ScriptBuf::new_p2wpkh(&WPubkeyHash::hash(&payment_key.serialize()))
|
||||
}
|
||||
|
@ -838,7 +838,7 @@ pub(crate) fn legacy_deserialization_prevention_marker_for_channel_type_features
|
|||
|
||||
/// Gets the witnessScript for the to_remote output when anchors are enabled.
|
||||
#[inline]
|
||||
pub fn get_to_countersignatory_with_anchors_redeemscript(payment_point: &PublicKey) -> ScriptBuf {
|
||||
pub fn get_to_countersigner_keyed_anchor_redeemscript(payment_point: &PublicKey) -> ScriptBuf {
|
||||
Builder::new()
|
||||
.push_slice(payment_point.serialize())
|
||||
.push_opcode(opcodes::all::OP_CHECKSIGVERIFY)
|
||||
|
@ -847,14 +847,20 @@ pub fn get_to_countersignatory_with_anchors_redeemscript(payment_point: &PublicK
|
|||
.into_script()
|
||||
}
|
||||
|
||||
/// Gets the witnessScript for an anchor output from the funding public key.
|
||||
/// Gets the script_pubkey for a shared anchor
|
||||
pub fn shared_anchor_script_pubkey() -> ScriptBuf {
|
||||
Builder::new().push_int(1).push_slice(&[0x4e, 0x73]).into_script()
|
||||
}
|
||||
|
||||
/// Gets the witnessScript for a keyed anchor (non-zero-fee-commitments) output from the funding
|
||||
/// public key.
|
||||
///
|
||||
/// The witness in the spending input must be:
|
||||
/// <BIP 143 funding_signature>
|
||||
/// After 16 blocks of confirmation, an alternative satisfying witness could be:
|
||||
/// <>
|
||||
/// (empty vector required to satisfy compliance with MINIMALIF-standard rule)
|
||||
#[inline]
|
||||
pub fn get_anchor_redeemscript(funding_pubkey: &PublicKey) -> ScriptBuf {
|
||||
pub fn get_keyed_anchor_redeemscript(funding_pubkey: &PublicKey) -> ScriptBuf {
|
||||
Builder::new().push_slice(funding_pubkey.serialize())
|
||||
.push_opcode(opcodes::all::OP_CHECKSIG)
|
||||
.push_opcode(opcodes::all::OP_IFDUP)
|
||||
|
@ -865,17 +871,19 @@ pub fn get_anchor_redeemscript(funding_pubkey: &PublicKey) -> ScriptBuf {
|
|||
.into_script()
|
||||
}
|
||||
|
||||
/// Locates the output with an anchor script paying to `funding_pubkey` within `commitment_tx`.
|
||||
pub(crate) fn get_anchor_output<'a>(commitment_tx: &'a Transaction, funding_pubkey: &PublicKey) -> Option<(u32, &'a TxOut)> {
|
||||
let anchor_script = get_anchor_redeemscript(funding_pubkey).to_p2wsh();
|
||||
/// Locates the output with a keyed anchor (non-zero-fee-commitments) script paying to
|
||||
/// `funding_pubkey` within `commitment_tx`.
|
||||
pub(crate) fn get_keyed_anchor_output<'a>(commitment_tx: &'a Transaction, funding_pubkey: &PublicKey) -> Option<(u32, &'a TxOut)> {
|
||||
let anchor_script = get_keyed_anchor_redeemscript(funding_pubkey).to_p2wsh();
|
||||
commitment_tx.output.iter().enumerate()
|
||||
.find(|(_, txout)| txout.script_pubkey == anchor_script)
|
||||
.map(|(idx, txout)| (idx as u32, txout))
|
||||
}
|
||||
|
||||
/// Returns the witness required to satisfy and spend an anchor input.
|
||||
pub fn build_anchor_input_witness(funding_key: &PublicKey, funding_sig: &Signature) -> Witness {
|
||||
let anchor_redeem_script = get_anchor_redeemscript(funding_key);
|
||||
/// Returns the witness required to satisfy and spend a keyed anchor (non-zero-fee-commitments)
|
||||
/// input.
|
||||
pub fn build_keyed_anchor_input_witness(funding_key: &PublicKey, funding_sig: &Signature) -> Witness {
|
||||
let anchor_redeem_script = get_keyed_anchor_redeemscript(funding_key);
|
||||
let mut ret = Witness::new();
|
||||
ret.push_ecdsa_signature(&BitcoinSignature::sighash_all(*funding_sig));
|
||||
ret.push(anchor_redeem_script.as_bytes());
|
||||
|
@ -1117,7 +1125,7 @@ impl<'a> DirectedChannelTransactionParameters<'a> {
|
|||
self.inner.funding_outpoint.unwrap().into_bitcoin_outpoint()
|
||||
}
|
||||
|
||||
/// Whether to use anchors for this channel
|
||||
/// The type of channel these parameters are for
|
||||
pub fn channel_type_features(&self) -> &'a ChannelTypeFeatures {
|
||||
&self.inner.channel_type_features
|
||||
}
|
||||
|
@ -1574,7 +1582,7 @@ impl CommitmentTransaction {
|
|||
|
||||
if to_countersignatory_value_sat > Amount::ZERO {
|
||||
let script = if channel_parameters.channel_type_features().supports_anchors_zero_fee_htlc_tx() {
|
||||
get_to_countersignatory_with_anchors_redeemscript(&countersignatory_pubkeys.payment_point).to_p2wsh()
|
||||
get_to_countersigner_keyed_anchor_redeemscript(&countersignatory_pubkeys.payment_point).to_p2wsh()
|
||||
} else {
|
||||
ScriptBuf::new_p2wpkh(&Hash160::hash(&countersignatory_pubkeys.payment_point.serialize()).into())
|
||||
};
|
||||
|
@ -1604,7 +1612,7 @@ impl CommitmentTransaction {
|
|||
|
||||
if channel_parameters.channel_type_features().supports_anchors_zero_fee_htlc_tx() {
|
||||
if to_broadcaster_value_sat > Amount::ZERO || !htlcs_with_aux.is_empty() {
|
||||
let anchor_script = get_anchor_redeemscript(broadcaster_funding_key);
|
||||
let anchor_script = get_keyed_anchor_redeemscript(broadcaster_funding_key);
|
||||
txouts.push((
|
||||
TxOut {
|
||||
script_pubkey: anchor_script.to_p2wsh(),
|
||||
|
@ -1615,7 +1623,7 @@ impl CommitmentTransaction {
|
|||
}
|
||||
|
||||
if to_countersignatory_value_sat > Amount::ZERO || !htlcs_with_aux.is_empty() {
|
||||
let anchor_script = get_anchor_redeemscript(countersignatory_funding_key);
|
||||
let anchor_script = get_keyed_anchor_redeemscript(countersignatory_funding_key);
|
||||
txouts.push((
|
||||
TxOut {
|
||||
script_pubkey: anchor_script.to_p2wsh(),
|
||||
|
@ -1953,7 +1961,7 @@ pub fn get_commitment_transaction_number_obscure_factor(
|
|||
mod tests {
|
||||
use super::{CounterpartyCommitmentSecrets, ChannelPublicKeys};
|
||||
use crate::chain;
|
||||
use crate::ln::chan_utils::{get_htlc_redeemscript, get_to_countersignatory_with_anchors_redeemscript, CommitmentTransaction, TxCreationKeys, ChannelTransactionParameters, CounterpartyChannelTransactionParameters, HTLCOutputInCommitment};
|
||||
use crate::ln::chan_utils::{get_htlc_redeemscript, get_to_countersigner_keyed_anchor_redeemscript, CommitmentTransaction, TxCreationKeys, ChannelTransactionParameters, CounterpartyChannelTransactionParameters, HTLCOutputInCommitment};
|
||||
use bitcoin::secp256k1::{PublicKey, SecretKey, Secp256k1};
|
||||
use crate::util::test_utils;
|
||||
use crate::sign::{ChannelSigner, SignerProvider};
|
||||
|
@ -2043,7 +2051,7 @@ mod tests {
|
|||
builder.channel_parameters.channel_type_features = ChannelTypeFeatures::anchors_zero_htlc_fee_and_dependencies();
|
||||
let tx = builder.build(1000, 2000);
|
||||
assert_eq!(tx.built.transaction.output.len(), 4);
|
||||
assert_eq!(tx.built.transaction.output[3].script_pubkey, get_to_countersignatory_with_anchors_redeemscript(&builder.counterparty_pubkeys.payment_point).to_p2wsh());
|
||||
assert_eq!(tx.built.transaction.output[3].script_pubkey, get_to_countersigner_keyed_anchor_redeemscript(&builder.counterparty_pubkeys.payment_point).to_p2wsh());
|
||||
|
||||
// Generate broadcaster output and anchor
|
||||
let tx = builder.build(3000, 0);
|
||||
|
|
|
@ -212,7 +212,7 @@ pub trait EcdsaChannelSigner: ChannelSigner {
|
|||
&self, channel_parameters: &ChannelTransactionParameters, closing_tx: &ClosingTransaction,
|
||||
secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
) -> Result<Signature, ()>;
|
||||
/// Computes the signature for a commitment transaction's anchor output used as an
|
||||
/// Computes the signature for a commitment transaction's keyed anchor output used as an
|
||||
/// input within `anchor_tx`, which spends the commitment transaction, at index `input`.
|
||||
///
|
||||
/// An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid
|
||||
|
@ -222,7 +222,7 @@ pub trait EcdsaChannelSigner: ChannelSigner {
|
|||
///
|
||||
/// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked
|
||||
/// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked
|
||||
fn sign_holder_anchor_input(
|
||||
fn sign_holder_keyed_anchor_input(
|
||||
&self, channel_parameters: &ChannelTransactionParameters, anchor_tx: &Transaction,
|
||||
input: usize, secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
) -> Result<Signature, ()>;
|
||||
|
|
|
@ -166,7 +166,7 @@ impl StaticPaymentOutputDescriptor {
|
|||
self.channel_transaction_parameters.as_ref().and_then(|channel_params| {
|
||||
if channel_params.channel_type_features.supports_anchors_zero_fee_htlc_tx() {
|
||||
let payment_point = channel_params.holder_pubkeys.payment_point;
|
||||
Some(chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point))
|
||||
Some(chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&payment_point))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -1178,7 +1178,7 @@ impl InMemorySigner {
|
|||
.unwrap_or(false);
|
||||
|
||||
let witness_script = if supports_anchors_zero_fee_htlc_tx {
|
||||
chan_utils::get_to_countersignatory_with_anchors_redeemscript(&remotepubkey.inner)
|
||||
chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&remotepubkey.inner)
|
||||
} else {
|
||||
ScriptBuf::new_p2pkh(&remotepubkey.pubkey_hash())
|
||||
};
|
||||
|
@ -1640,23 +1640,19 @@ impl EcdsaChannelSigner for InMemorySigner {
|
|||
))
|
||||
}
|
||||
|
||||
fn sign_holder_anchor_input(
|
||||
&self, channel_parameters: &ChannelTransactionParameters, anchor_tx: &Transaction,
|
||||
input: usize, secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
fn sign_holder_keyed_anchor_input(
|
||||
&self, chan_params: &ChannelTransactionParameters, anchor_tx: &Transaction, input: usize,
|
||||
secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
) -> Result<Signature, ()> {
|
||||
assert!(channel_parameters.is_populated(), "Channel parameters must be fully populated");
|
||||
assert!(chan_params.is_populated(), "Channel parameters must be fully populated");
|
||||
|
||||
let witness_script =
|
||||
chan_utils::get_anchor_redeemscript(&channel_parameters.holder_pubkeys.funding_pubkey);
|
||||
chan_utils::get_keyed_anchor_redeemscript(&chan_params.holder_pubkeys.funding_pubkey);
|
||||
let amt = Amount::from_sat(ANCHOR_OUTPUT_VALUE_SATOSHI);
|
||||
let sighash = sighash::SighashCache::new(&*anchor_tx)
|
||||
.p2wsh_signature_hash(
|
||||
input,
|
||||
&witness_script,
|
||||
Amount::from_sat(ANCHOR_OUTPUT_VALUE_SATOSHI),
|
||||
EcdsaSighashType::All,
|
||||
)
|
||||
.p2wsh_signature_hash(input, &witness_script, amt, EcdsaSighashType::All)
|
||||
.unwrap();
|
||||
let funding_key = self.funding_key(channel_parameters.splice_parent_funding_txid);
|
||||
let funding_key = self.funding_key(chan_params.splice_parent_funding_txid);
|
||||
Ok(sign_with_aux_rand(secp_ctx, &hash_to_message!(&sighash[..]), &funding_key, &self))
|
||||
}
|
||||
|
||||
|
@ -1751,12 +1747,6 @@ impl TaprootChannelSigner for InMemorySigner {
|
|||
) -> Result<PartialSignature, ()> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn sign_holder_anchor_input(
|
||||
&self, anchor_tx: &Transaction, input: usize, secp_ctx: &Secp256k1<All>,
|
||||
) -> Result<schnorr::Signature, ()> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
/// Simple implementation of [`EntropySource`], [`NodeSigner`], and [`SignerProvider`] that takes a
|
||||
|
|
|
@ -151,11 +151,5 @@ pub trait TaprootChannelSigner: ChannelSigner {
|
|||
&self, closing_tx: &ClosingTransaction, secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
) -> Result<PartialSignature, ()>;
|
||||
|
||||
/// Computes the signature for a commitment transaction's anchor output used as an
|
||||
/// input within `anchor_tx`, which spends the commitment transaction, at index `input`.
|
||||
fn sign_holder_anchor_input(
|
||||
&self, anchor_tx: &Transaction, input: usize, secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
) -> Result<Signature, ()>;
|
||||
|
||||
// TODO: sign channel announcement
|
||||
}
|
||||
|
|
|
@ -117,12 +117,6 @@ impl TaprootChannelSigner for DynSigner {
|
|||
) -> Result<PartialSignature, ()> {
|
||||
todo!();
|
||||
}
|
||||
|
||||
fn sign_holder_anchor_input(
|
||||
&self, anchor_tx: &Transaction, input: usize, secp_ctx: &Secp256k1<All>,
|
||||
) -> Result<secp256k1::schnorr::Signature, ()> {
|
||||
todo!();
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for DynSigner {
|
||||
|
@ -158,7 +152,7 @@ delegate!(DynSigner, EcdsaChannelSigner, inner,
|
|||
channel_parameters: &ChannelTransactionParameters, msg: &UnsignedChannelAnnouncement,
|
||||
secp_ctx: &Secp256k1<secp256k1::All>
|
||||
) -> Result<Signature, ()>,
|
||||
fn sign_holder_anchor_input(, channel_parameters: &ChannelTransactionParameters,
|
||||
fn sign_holder_keyed_anchor_input(, channel_parameters: &ChannelTransactionParameters,
|
||||
anchor_tx: &Transaction, input: usize,
|
||||
secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()>,
|
||||
fn sign_holder_htlc_transaction(, htlc_tx: &Transaction, input: usize,
|
||||
|
|
|
@ -445,9 +445,9 @@ impl EcdsaChannelSigner for TestChannelSigner {
|
|||
Ok(self.inner.sign_closing_transaction(channel_parameters, closing_tx, secp_ctx).unwrap())
|
||||
}
|
||||
|
||||
fn sign_holder_anchor_input(
|
||||
&self, channel_parameters: &ChannelTransactionParameters, anchor_tx: &Transaction,
|
||||
input: usize, secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
fn sign_holder_keyed_anchor_input(
|
||||
&self, chan_params: &ChannelTransactionParameters, anchor_tx: &Transaction, input: usize,
|
||||
secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
) -> Result<Signature, ()> {
|
||||
debug_assert!(MIN_CHAN_DUST_LIMIT_SATOSHIS > ANCHOR_OUTPUT_VALUE_SATOSHI);
|
||||
// As long as our minimum dust limit is enforced and is greater than our anchor output
|
||||
|
@ -460,13 +460,7 @@ impl EcdsaChannelSigner for TestChannelSigner {
|
|||
if !self.is_signer_available(SignerOp::SignHolderAnchorInput) {
|
||||
return Err(());
|
||||
}
|
||||
EcdsaChannelSigner::sign_holder_anchor_input(
|
||||
&self.inner,
|
||||
channel_parameters,
|
||||
anchor_tx,
|
||||
input,
|
||||
secp_ctx,
|
||||
)
|
||||
self.inner.sign_holder_keyed_anchor_input(chan_params, anchor_tx, input, secp_ctx)
|
||||
}
|
||||
|
||||
fn sign_channel_announcement_with_funding_key(
|
||||
|
@ -547,12 +541,6 @@ impl TaprootChannelSigner for TestChannelSigner {
|
|||
) -> Result<PartialSignature, ()> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn sign_holder_anchor_input(
|
||||
&self, anchor_tx: &Transaction, input: usize, secp_ctx: &Secp256k1<All>,
|
||||
) -> Result<secp256k1::schnorr::Signature, ()> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl TestChannelSigner {
|
||||
|
|
Loading…
Add table
Reference in a new issue