Skip to content

Commit 935a716

Browse files
yellowredTheBlueMatt
authored andcommitted
Implement struct wrappers for channel key types to avoid confusion.
Currently all channel keys and their basepoints exist uniformly as `PublicKey` type, which not only makes in harder for a developer to distinguish those entities, but also does not engage the language type system to check if the correct key is being used in any particular function. Having struct wrappers around keys also enables more nuanced semantics allowing to express Lightning Protocol rules in language. For example, the code allows to derive `HtlcKey` from `HtlcBasepoint` and not from `PaymentBasepoint`. This change is transparent for channel monitors that will use the internal public key of a wrapper. Payment, DelayedPayment, HTLC and Revocation basepoints and their derived keys are now wrapped into a specific struct that make it distinguishable for the Rust type system. Functions that require a specific key or basepoint should not use generic Public Key, but require a specific key wrapper struct to engage Rust type verification system and make it more clear for developers which key is used.
1 parent 70ea110 commit 935a716

File tree

8 files changed

+407
-193
lines changed

8 files changed

+407
-193
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ use bitcoin::sighash::EcdsaSighashType;
3636
use crate::ln::channel::INITIAL_COMMITMENT_NUMBER;
3737
use crate::ln::{PaymentHash, PaymentPreimage};
3838
use crate::ln::msgs::DecodeError;
39-
use crate::ln::chan_utils;
40-
use crate::ln::chan_utils::{CommitmentTransaction, CounterpartyCommitmentSecrets, HTLCOutputInCommitment, HTLCClaim, ChannelTransactionParameters, HolderCommitmentTransaction, TxCreationKeys};
39+
use crate::ln::channel_keys::{DelayedPaymentKey, DelayedPaymentBasepoint, HtlcBasepoint, HtlcKey, RevocationKey, RevocationBasepoint};
40+
use crate::ln::chan_utils::{self,CommitmentTransaction, CounterpartyCommitmentSecrets, HTLCOutputInCommitment, HTLCClaim, ChannelTransactionParameters, HolderCommitmentTransaction, TxCreationKeys};
4141
use crate::ln::channelmanager::{HTLCSource, SentHTLCId};
4242
use crate::chain;
4343
use crate::chain::{BestBlock, WatchedOutput};
@@ -238,10 +238,10 @@ pub(crate) const HTLC_FAIL_BACK_BUFFER: u32 = CLTV_CLAIM_BUFFER + LATENCY_GRACE_
238238
struct HolderSignedTx {
239239
/// txid of the transaction in tx, just used to make comparison faster
240240
txid: Txid,
241-
revocation_key: PublicKey,
242-
a_htlc_key: PublicKey,
243-
b_htlc_key: PublicKey,
244-
delayed_payment_key: PublicKey,
241+
revocation_key: RevocationKey,
242+
a_htlc_key: HtlcKey,
243+
b_htlc_key: HtlcKey,
244+
delayed_payment_key: DelayedPaymentKey,
245245
per_commitment_point: PublicKey,
246246
htlc_outputs: Vec<(HTLCOutputInCommitment, Option<Signature>, Option<HTLCSource>)>,
247247
to_self_value_sat: u64,
@@ -278,8 +278,8 @@ impl HolderSignedTx {
278278
/// justice or 2nd-stage preimage/timeout transactions.
279279
#[derive(Clone, PartialEq, Eq)]
280280
struct CounterpartyCommitmentParameters {
281-
counterparty_delayed_payment_base_key: PublicKey,
282-
counterparty_htlc_base_key: PublicKey,
281+
counterparty_delayed_payment_base_key: DelayedPaymentBasepoint,
282+
counterparty_htlc_base_key: HtlcBasepoint,
283283
on_counterparty_tx_csv: u16,
284284
}
285285

@@ -752,12 +752,12 @@ pub(crate) struct ChannelMonitorImpl<Signer: WriteableEcdsaChannelSigner> {
752752
commitment_transaction_number_obscure_factor: u64,
753753

754754
destination_script: ScriptBuf,
755-
broadcasted_holder_revokable_script: Option<(ScriptBuf, PublicKey, PublicKey)>,
755+
broadcasted_holder_revokable_script: Option<(ScriptBuf, PublicKey, RevocationKey)>,
756756
counterparty_payment_script: ScriptBuf,
757757
shutdown_script: Option<ScriptBuf>,
758758

759759
channel_keys_id: [u8; 32],
760-
holder_revocation_basepoint: PublicKey,
760+
holder_revocation_basepoint: RevocationBasepoint,
761761
funding_info: (OutPoint, ScriptBuf),
762762
current_counterparty_commitment_txid: Option<Txid>,
763763
prev_counterparty_commitment_txid: Option<Txid>,
@@ -2924,12 +2924,10 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
29242924
let their_per_commitment_point = PublicKey::from_secret_key(
29252925
&self.onchain_tx_handler.secp_ctx, &per_commitment_key);
29262926

2927-
let revocation_pubkey = chan_utils::derive_public_revocation_key(
2928-
&self.onchain_tx_handler.secp_ctx, &their_per_commitment_point,
2929-
&self.holder_revocation_basepoint);
2930-
let delayed_key = chan_utils::derive_public_key(&self.onchain_tx_handler.secp_ctx,
2931-
&their_per_commitment_point,
2932-
&self.counterparty_commitment_params.counterparty_delayed_payment_base_key);
2927+
let revocation_pubkey = RevocationKey::from_basepoint(&self.onchain_tx_handler.secp_ctx,
2928+
&self.holder_revocation_basepoint, &their_per_commitment_point);
2929+
let delayed_key = DelayedPaymentKey::from_basepoint(&self.onchain_tx_handler.secp_ctx,
2930+
&self.counterparty_commitment_params.counterparty_delayed_payment_base_key, &their_per_commitment_point);
29332931
let revokeable_redeemscript = chan_utils::get_revokeable_redeemscript(&revocation_pubkey,
29342932
self.counterparty_commitment_params.on_counterparty_tx_csv, &delayed_key);
29352933

@@ -2992,8 +2990,8 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
29922990
let secret = self.get_secret(commitment_number).unwrap();
29932991
let per_commitment_key = ignore_error!(SecretKey::from_slice(&secret));
29942992
let per_commitment_point = PublicKey::from_secret_key(&self.onchain_tx_handler.secp_ctx, &per_commitment_key);
2995-
let revocation_pubkey = chan_utils::derive_public_revocation_key(&self.onchain_tx_handler.secp_ctx, &per_commitment_point, &self.holder_revocation_basepoint);
2996-
let delayed_key = chan_utils::derive_public_key(&self.onchain_tx_handler.secp_ctx, &PublicKey::from_secret_key(&self.onchain_tx_handler.secp_ctx, &per_commitment_key), &self.counterparty_commitment_params.counterparty_delayed_payment_base_key);
2993+
let revocation_pubkey = RevocationKey::from_basepoint(&self.onchain_tx_handler.secp_ctx, &self.holder_revocation_basepoint, &per_commitment_point,);
2994+
let delayed_key = DelayedPaymentKey::from_basepoint(&self.onchain_tx_handler.secp_ctx, &self.counterparty_commitment_params.counterparty_delayed_payment_base_key, &PublicKey::from_secret_key(&self.onchain_tx_handler.secp_ctx, &per_commitment_key));
29972995

29982996
let revokeable_redeemscript = chan_utils::get_revokeable_redeemscript(&revocation_pubkey, self.counterparty_commitment_params.on_counterparty_tx_csv, &delayed_key);
29992997
let revokeable_p2wsh = revokeable_redeemscript.to_v0_p2wsh();
@@ -3105,11 +3103,11 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
31053103
} else { return (claimable_outpoints, to_counterparty_output_info); };
31063104

31073105
if let Some(transaction) = tx {
3108-
let revocation_pubkey = chan_utils::derive_public_revocation_key(
3109-
&self.onchain_tx_handler.secp_ctx, &per_commitment_point, &self.holder_revocation_basepoint);
3110-
let delayed_key = chan_utils::derive_public_key(&self.onchain_tx_handler.secp_ctx,
3111-
&per_commitment_point,
3112-
&self.counterparty_commitment_params.counterparty_delayed_payment_base_key);
3106+
let revocation_pubkey = RevocationKey::from_basepoint(
3107+
&self.onchain_tx_handler.secp_ctx, &self.holder_revocation_basepoint, &per_commitment_point);
3108+
3109+
let delayed_key = DelayedPaymentKey::from_basepoint(&self.onchain_tx_handler.secp_ctx, &self.counterparty_commitment_params.counterparty_delayed_payment_base_key, &per_commitment_point);
3110+
31133111
let revokeable_p2wsh = chan_utils::get_revokeable_redeemscript(&revocation_pubkey,
31143112
self.counterparty_commitment_params.on_counterparty_tx_csv,
31153113
&delayed_key).to_v0_p2wsh();
@@ -3204,7 +3202,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
32043202
// Returns (1) `PackageTemplate`s that can be given to the OnchainTxHandler, so that the handler can
32053203
// broadcast transactions claiming holder HTLC commitment outputs and (2) a holder revokable
32063204
// script so we can detect whether a holder transaction has been seen on-chain.
3207-
fn get_broadcasted_holder_claims(&self, holder_tx: &HolderSignedTx, conf_height: u32) -> (Vec<PackageTemplate>, Option<(ScriptBuf, PublicKey, PublicKey)>) {
3205+
fn get_broadcasted_holder_claims(&self, holder_tx: &HolderSignedTx, conf_height: u32) -> (Vec<PackageTemplate>, Option<(ScriptBuf, PublicKey, RevocationKey)>) {
32083206
let mut claim_requests = Vec::with_capacity(holder_tx.htlc_outputs.len());
32093207

32103208
let redeemscript = chan_utils::get_revokeable_redeemscript(&holder_tx.revocation_key, self.on_holder_tx_csv, &holder_tx.delayed_payment_key);
@@ -4093,7 +4091,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
40934091
per_commitment_point: broadcasted_holder_revokable_script.1,
40944092
to_self_delay: self.on_holder_tx_csv,
40954093
output: outp.clone(),
4096-
revocation_pubkey: broadcasted_holder_revokable_script.2.clone(),
4094+
revocation_pubkey: broadcasted_holder_revokable_script.2,
40974095
channel_keys_id: self.channel_keys_id,
40984096
channel_value_satoshis: self.channel_value_satoshis,
40994097
}));
@@ -4506,8 +4504,8 @@ mod tests {
45064504
use crate::chain::transaction::OutPoint;
45074505
use crate::sign::InMemorySigner;
45084506
use crate::ln::{PaymentPreimage, PaymentHash};
4509-
use crate::ln::chan_utils;
4510-
use crate::ln::chan_utils::{HTLCOutputInCommitment, ChannelPublicKeys, ChannelTransactionParameters, HolderCommitmentTransaction, CounterpartyChannelTransactionParameters};
4507+
use crate::ln::channel_keys::{DelayedPaymentBasepoint, DelayedPaymentKey, HtlcBasepoint, RevocationBasepoint, RevocationKey};
4508+
use crate::ln::chan_utils::{self,HTLCOutputInCommitment, ChannelPublicKeys, ChannelTransactionParameters, HolderCommitmentTransaction, CounterpartyChannelTransactionParameters};
45114509
use crate::ln::channelmanager::{PaymentSendFailure, PaymentId, RecipientOnionFields};
45124510
use crate::ln::functional_test_utils::*;
45134511
use crate::ln::script::ShutdownScript;
@@ -4674,10 +4672,10 @@ mod tests {
46744672

46754673
let counterparty_pubkeys = ChannelPublicKeys {
46764674
funding_pubkey: PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[44; 32]).unwrap()),
4677-
revocation_basepoint: PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[45; 32]).unwrap()),
4675+
revocation_basepoint: RevocationBasepoint::from(PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[45; 32]).unwrap())),
46784676
payment_point: PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[46; 32]).unwrap()),
4679-
delayed_payment_basepoint: PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[47; 32]).unwrap()),
4680-
htlc_basepoint: PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[48; 32]).unwrap())
4677+
delayed_payment_basepoint: DelayedPaymentBasepoint::from(PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[47; 32]).unwrap())),
4678+
htlc_basepoint: HtlcBasepoint::from(PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[48; 32]).unwrap()))
46814679
};
46824680
let funding_outpoint = OutPoint { txid: Txid::all_zeros(), index: u16::max_value() };
46834681
let channel_parameters = ChannelTransactionParameters {
@@ -4767,6 +4765,7 @@ mod tests {
47674765
let privkey = SecretKey::from_slice(&<Vec<u8>>::from_hex("0101010101010101010101010101010101010101010101010101010101010101").unwrap()[..]).unwrap();
47684766
let pubkey = PublicKey::from_secret_key(&secp_ctx, &privkey);
47694767

4768+
use crate::ln::channel_keys::{HtlcKey, HtlcBasepoint};
47704769
macro_rules! sign_input {
47714770
($sighash_parts: expr, $idx: expr, $amount: expr, $weight: expr, $sum_actual_sigs: expr, $opt_anchors: expr) => {
47724771
let htlc = HTLCOutputInCommitment {
@@ -4776,7 +4775,7 @@ mod tests {
47764775
payment_hash: PaymentHash([1; 32]),
47774776
transaction_output_index: Some($idx as u32),
47784777
};
4779-
let redeem_script = if *$weight == WEIGHT_REVOKED_OUTPUT { chan_utils::get_revokeable_redeemscript(&pubkey, 256, &pubkey) } else { chan_utils::get_htlc_redeemscript_with_explicit_keys(&htlc, $opt_anchors, &pubkey, &pubkey, &pubkey) };
4778+
let redeem_script = if *$weight == WEIGHT_REVOKED_OUTPUT { chan_utils::get_revokeable_redeemscript(&RevocationKey::from_basepoint(&secp_ctx, &RevocationBasepoint::from(pubkey), &pubkey), 256, &DelayedPaymentKey::from_basepoint(&secp_ctx, &DelayedPaymentBasepoint::from(pubkey), &pubkey)) } else { chan_utils::get_htlc_redeemscript_with_explicit_keys(&htlc, $opt_anchors, &HtlcKey::from_basepoint(&secp_ctx, &HtlcBasepoint::from(pubkey), &pubkey), &HtlcKey::from_basepoint(&secp_ctx, &HtlcBasepoint::from(pubkey), &pubkey), &RevocationKey::from_basepoint(&secp_ctx, &RevocationBasepoint::from(pubkey), &pubkey)) };
47804779
let sighash = hash_to_message!(&$sighash_parts.segwit_signature_hash($idx, &redeem_script, $amount, EcdsaSighashType::All).unwrap()[..]);
47814780
let sig = secp_ctx.sign_ecdsa(&sighash, &privkey);
47824781
let mut ser_sig = sig.serialize_der().to_vec();

lightning/src/chain/package.rs

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ use bitcoin::secp256k1::{SecretKey,PublicKey};
2323
use bitcoin::sighash::EcdsaSighashType;
2424

2525
use crate::ln::PaymentPreimage;
26-
use crate::ln::chan_utils::{TxCreationKeys, HTLCOutputInCommitment};
27-
use crate::ln::chan_utils;
26+
use crate::ln::chan_utils::{self, TxCreationKeys, HTLCOutputInCommitment};
2827
use crate::ln::features::ChannelTypeFeatures;
28+
use crate::ln::channel_keys::{DelayedPaymentBasepoint, HtlcBasepoint};
2929
use crate::ln::msgs::DecodeError;
3030
use crate::chain::chaininterface::{FeeEstimator, ConfirmationTarget, MIN_RELAY_FEE_SAT_PER_1000_WEIGHT, compute_feerate_sat_per_1000_weight, FEERATE_FLOOR_SATS_PER_KW};
3131
use crate::sign::WriteableEcdsaChannelSigner;
@@ -115,8 +115,8 @@ const HIGH_FREQUENCY_BUMP_INTERVAL: u32 = 1;
115115
#[derive(Clone, PartialEq, Eq)]
116116
pub(crate) struct RevokedOutput {
117117
per_commitment_point: PublicKey,
118-
counterparty_delayed_payment_base_key: PublicKey,
119-
counterparty_htlc_base_key: PublicKey,
118+
counterparty_delayed_payment_base_key: DelayedPaymentBasepoint,
119+
counterparty_htlc_base_key: HtlcBasepoint,
120120
per_commitment_key: SecretKey,
121121
weight: u64,
122122
amount: u64,
@@ -125,7 +125,7 @@ pub(crate) struct RevokedOutput {
125125
}
126126

127127
impl RevokedOutput {
128-
pub(crate) fn build(per_commitment_point: PublicKey, counterparty_delayed_payment_base_key: PublicKey, counterparty_htlc_base_key: PublicKey, per_commitment_key: SecretKey, amount: u64, on_counterparty_tx_csv: u16, is_counterparty_balance_on_anchors: bool) -> Self {
128+
pub(crate) fn build(per_commitment_point: PublicKey, counterparty_delayed_payment_base_key: DelayedPaymentBasepoint, counterparty_htlc_base_key: HtlcBasepoint, per_commitment_key: SecretKey, amount: u64, on_counterparty_tx_csv: u16, is_counterparty_balance_on_anchors: bool) -> Self {
129129
RevokedOutput {
130130
per_commitment_point,
131131
counterparty_delayed_payment_base_key,
@@ -161,16 +161,16 @@ impl_writeable_tlv_based!(RevokedOutput, {
161161
#[derive(Clone, PartialEq, Eq)]
162162
pub(crate) struct RevokedHTLCOutput {
163163
per_commitment_point: PublicKey,
164-
counterparty_delayed_payment_base_key: PublicKey,
165-
counterparty_htlc_base_key: PublicKey,
164+
counterparty_delayed_payment_base_key: DelayedPaymentBasepoint,
165+
counterparty_htlc_base_key: HtlcBasepoint,
166166
per_commitment_key: SecretKey,
167167
weight: u64,
168168
amount: u64,
169169
htlc: HTLCOutputInCommitment,
170170
}
171171

172172
impl RevokedHTLCOutput {
173-
pub(crate) fn build(per_commitment_point: PublicKey, counterparty_delayed_payment_base_key: PublicKey, counterparty_htlc_base_key: PublicKey, per_commitment_key: SecretKey, amount: u64, htlc: HTLCOutputInCommitment, channel_type_features: &ChannelTypeFeatures) -> Self {
173+
pub(crate) fn build(per_commitment_point: PublicKey, counterparty_delayed_payment_base_key: DelayedPaymentBasepoint, counterparty_htlc_base_key: HtlcBasepoint, per_commitment_key: SecretKey, amount: u64, htlc: HTLCOutputInCommitment, channel_type_features: &ChannelTypeFeatures) -> Self {
174174
let weight = if htlc.offered { weight_revoked_offered_htlc(channel_type_features) } else { weight_revoked_received_htlc(channel_type_features) };
175175
RevokedHTLCOutput {
176176
per_commitment_point,
@@ -205,15 +205,15 @@ impl_writeable_tlv_based!(RevokedHTLCOutput, {
205205
#[derive(Clone, PartialEq, Eq)]
206206
pub(crate) struct CounterpartyOfferedHTLCOutput {
207207
per_commitment_point: PublicKey,
208-
counterparty_delayed_payment_base_key: PublicKey,
209-
counterparty_htlc_base_key: PublicKey,
208+
counterparty_delayed_payment_base_key: DelayedPaymentBasepoint,
209+
counterparty_htlc_base_key: HtlcBasepoint,
210210
preimage: PaymentPreimage,
211211
htlc: HTLCOutputInCommitment,
212212
channel_type_features: ChannelTypeFeatures,
213213
}
214214

215215
impl CounterpartyOfferedHTLCOutput {
216-
pub(crate) fn build(per_commitment_point: PublicKey, counterparty_delayed_payment_base_key: PublicKey, counterparty_htlc_base_key: PublicKey, preimage: PaymentPreimage, htlc: HTLCOutputInCommitment, channel_type_features: ChannelTypeFeatures) -> Self {
216+
pub(crate) fn build(per_commitment_point: PublicKey, counterparty_delayed_payment_base_key: DelayedPaymentBasepoint, counterparty_htlc_base_key: HtlcBasepoint, preimage: PaymentPreimage, htlc: HTLCOutputInCommitment, channel_type_features: ChannelTypeFeatures) -> Self {
217217
CounterpartyOfferedHTLCOutput {
218218
per_commitment_point,
219219
counterparty_delayed_payment_base_key,
@@ -283,14 +283,14 @@ impl Readable for CounterpartyOfferedHTLCOutput {
283283
#[derive(Clone, PartialEq, Eq)]
284284
pub(crate) struct CounterpartyReceivedHTLCOutput {
285285
per_commitment_point: PublicKey,
286-
counterparty_delayed_payment_base_key: PublicKey,
287-
counterparty_htlc_base_key: PublicKey,
286+
counterparty_delayed_payment_base_key: DelayedPaymentBasepoint,
287+
counterparty_htlc_base_key: HtlcBasepoint,
288288
htlc: HTLCOutputInCommitment,
289289
channel_type_features: ChannelTypeFeatures,
290290
}
291291

292292
impl CounterpartyReceivedHTLCOutput {
293-
pub(crate) fn build(per_commitment_point: PublicKey, counterparty_delayed_payment_base_key: PublicKey, counterparty_htlc_base_key: PublicKey, htlc: HTLCOutputInCommitment, channel_type_features: ChannelTypeFeatures) -> Self {
293+
pub(crate) fn build(per_commitment_point: PublicKey, counterparty_delayed_payment_base_key: DelayedPaymentBasepoint, counterparty_htlc_base_key: HtlcBasepoint, htlc: HTLCOutputInCommitment, channel_type_features: ChannelTypeFeatures) -> Self {
294294
CounterpartyReceivedHTLCOutput {
295295
per_commitment_point,
296296
counterparty_delayed_payment_base_key,
@@ -600,7 +600,7 @@ impl PackageSolvingData {
600600
let mut ser_sig = sig.serialize_der().to_vec();
601601
ser_sig.push(EcdsaSighashType::All as u8);
602602
bumped_tx.input[i].witness.push(ser_sig);
603-
bumped_tx.input[i].witness.push(chan_keys.revocation_key.clone().serialize().to_vec());
603+
bumped_tx.input[i].witness.push(chan_keys.revocation_key.to_public_key().serialize().to_vec());
604604
bumped_tx.input[i].witness.push(witness_script.clone().into_bytes());
605605
} else { return false; }
606606
},
@@ -1191,6 +1191,7 @@ mod tests {
11911191
use crate::chain::Txid;
11921192
use crate::ln::chan_utils::HTLCOutputInCommitment;
11931193
use crate::ln::{PaymentPreimage, PaymentHash};
1194+
use crate::ln::channel_keys::{DelayedPaymentBasepoint, HtlcBasepoint};
11941195

11951196
use bitcoin::blockdata::constants::WITNESS_SCALE_FACTOR;
11961197
use bitcoin::blockdata::script::ScriptBuf;
@@ -1209,7 +1210,7 @@ mod tests {
12091210
{
12101211
let dumb_scalar = SecretKey::from_slice(&<Vec<u8>>::from_hex("0101010101010101010101010101010101010101010101010101010101010101").unwrap()[..]).unwrap();
12111212
let dumb_point = PublicKey::from_secret_key(&$secp_ctx, &dumb_scalar);
1212-
PackageSolvingData::RevokedOutput(RevokedOutput::build(dumb_point, dumb_point, dumb_point, dumb_scalar, 0, 0, $is_counterparty_balance_on_anchors))
1213+
PackageSolvingData::RevokedOutput(RevokedOutput::build(dumb_point, DelayedPaymentBasepoint::from(dumb_point), HtlcBasepoint::from(dumb_point), dumb_scalar, 0, 0, $is_counterparty_balance_on_anchors))
12131214
}
12141215
}
12151216
}
@@ -1221,7 +1222,7 @@ mod tests {
12211222
let dumb_point = PublicKey::from_secret_key(&$secp_ctx, &dumb_scalar);
12221223
let hash = PaymentHash([1; 32]);
12231224
let htlc = HTLCOutputInCommitment { offered: true, amount_msat: $amt, cltv_expiry: 0, payment_hash: hash, transaction_output_index: None };
1224-
PackageSolvingData::CounterpartyReceivedHTLCOutput(CounterpartyReceivedHTLCOutput::build(dumb_point, dumb_point, dumb_point, htlc, $opt_anchors))
1225+
PackageSolvingData::CounterpartyReceivedHTLCOutput(CounterpartyReceivedHTLCOutput::build(dumb_point, DelayedPaymentBasepoint::from(dumb_point), HtlcBasepoint::from(dumb_point), htlc, $opt_anchors))
12251226
}
12261227
}
12271228
}
@@ -1234,7 +1235,7 @@ mod tests {
12341235
let hash = PaymentHash([1; 32]);
12351236
let preimage = PaymentPreimage([2;32]);
12361237
let htlc = HTLCOutputInCommitment { offered: false, amount_msat: $amt, cltv_expiry: 1000, payment_hash: hash, transaction_output_index: None };
1237-
PackageSolvingData::CounterpartyOfferedHTLCOutput(CounterpartyOfferedHTLCOutput::build(dumb_point, dumb_point, dumb_point, preimage, htlc, $opt_anchors))
1238+
PackageSolvingData::CounterpartyOfferedHTLCOutput(CounterpartyOfferedHTLCOutput::build(dumb_point, DelayedPaymentBasepoint::from(dumb_point), HtlcBasepoint::from(dumb_point), preimage, htlc, $opt_anchors))
12381239
}
12391240
}
12401241
}

0 commit comments

Comments
 (0)