Skip to content

Commit 1693e70

Browse files
committed
Run rustfmt on sign/taproot.rs
1 parent 0c220c1 commit 1693e70

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

lightning/src/sign/taproot.rs

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
use alloc::vec::Vec;
44
use bitcoin::blockdata::transaction::Transaction;
55
use bitcoin::secp256k1;
6-
use bitcoin::secp256k1::{PublicKey, schnorr::Signature, Secp256k1, SecretKey};
6+
use bitcoin::secp256k1::{schnorr::Signature, PublicKey, Secp256k1, SecretKey};
77

88
use musig2::types::{PartialSignature, PublicNonce};
99

10-
use crate::ln::chan_utils::{ClosingTransaction, CommitmentTransaction, HolderCommitmentTransaction, HTLCOutputInCommitment};
10+
use crate::ln::chan_utils::{
11+
ClosingTransaction, CommitmentTransaction, HTLCOutputInCommitment, HolderCommitmentTransaction,
12+
};
1113
use crate::ln::msgs::PartialSignatureWithNonce;
1214
use crate::ln::PaymentPreimage;
1315
use crate::sign::{ChannelSigner, HTLCDescriptor};
@@ -18,7 +20,9 @@ use crate::sign::{ChannelSigner, HTLCDescriptor};
1820
pub trait TaprootChannelSigner: ChannelSigner {
1921
/// Generate a local nonce pair, which requires committing to ahead of time.
2022
/// The counterparty needs the public nonce generated herein to compute a partial signature.
21-
fn generate_local_nonce_pair(&self, commitment_number: u64, secp_ctx: &Secp256k1<secp256k1::All>) -> PublicNonce;
23+
fn generate_local_nonce_pair(
24+
&self, commitment_number: u64, secp_ctx: &Secp256k1<secp256k1::All>,
25+
) -> PublicNonce;
2226

2327
/// Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
2428
///
@@ -36,8 +40,8 @@ pub trait TaprootChannelSigner: ChannelSigner {
3640
/// irrelevant or duplicate preimages.
3741
//
3842
// TODO: Document the things someone using this interface should enforce before signing.
39-
fn partially_sign_counterparty_commitment(&self, counterparty_nonce: PublicNonce,
40-
commitment_tx: &CommitmentTransaction,
43+
fn partially_sign_counterparty_commitment(
44+
&self, counterparty_nonce: PublicNonce, commitment_tx: &CommitmentTransaction,
4145
inbound_htlc_preimages: Vec<PaymentPreimage>,
4246
outbound_htlc_preimages: Vec<PaymentPreimage>, secp_ctx: &Secp256k1<secp256k1::All>,
4347
) -> Result<(PartialSignatureWithNonce, Vec<Signature>), ()>;
@@ -53,9 +57,10 @@ pub trait TaprootChannelSigner: ChannelSigner {
5357
/// An external signer implementation should check that the commitment has not been revoked.
5458
///
5559
// TODO: Document the things someone using this interface should enforce before signing.
56-
fn finalize_holder_commitment(&self, commitment_tx: &HolderCommitmentTransaction,
60+
fn finalize_holder_commitment(
61+
&self, commitment_tx: &HolderCommitmentTransaction,
5762
counterparty_partial_signature: PartialSignatureWithNonce,
58-
secp_ctx: &Secp256k1<secp256k1::All>
63+
secp_ctx: &Secp256k1<secp256k1::All>,
5964
) -> Result<PartialSignature, ()>;
6065

6166
/// Create a signature for the given input in a transaction spending an HTLC transaction output
@@ -72,8 +77,9 @@ pub trait TaprootChannelSigner: ChannelSigner {
7277
/// revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
7378
/// not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
7479
/// so).
75-
fn sign_justice_revoked_output(&self, justice_tx: &Transaction, input: usize, amount: u64,
76-
per_commitment_key: &SecretKey, secp_ctx: &Secp256k1<secp256k1::All>,
80+
fn sign_justice_revoked_output(
81+
&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey,
82+
secp_ctx: &Secp256k1<secp256k1::All>,
7783
) -> Result<Signature, ()>;
7884

7985
/// Create a signature for the given input in a transaction spending a commitment transaction
@@ -94,9 +100,10 @@ pub trait TaprootChannelSigner: ChannelSigner {
94100
///
95101
/// `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
96102
/// (which is committed to in the BIP 341 signatures).
97-
fn sign_justice_revoked_htlc(&self, justice_tx: &Transaction, input: usize, amount: u64,
98-
per_commitment_key: &SecretKey, htlc: &HTLCOutputInCommitment,
99-
secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()>;
103+
fn sign_justice_revoked_htlc(
104+
&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey,
105+
htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<secp256k1::All>,
106+
) -> Result<Signature, ()>;
100107

101108
/// Computes the signature for a commitment transaction's HTLC output used as an input within
102109
/// `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
@@ -109,8 +116,9 @@ pub trait TaprootChannelSigner: ChannelSigner {
109116
///
110117
/// [`TapSighashType::Default`]: bitcoin::sighash::TapSighashType::Default
111118
/// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
112-
fn sign_holder_htlc_transaction(&self, htlc_tx: &Transaction, input: usize,
113-
htlc_descriptor: &HTLCDescriptor, secp_ctx: &Secp256k1<secp256k1::All>,
119+
fn sign_holder_htlc_transaction(
120+
&self, htlc_tx: &Transaction, input: usize, htlc_descriptor: &HTLCDescriptor,
121+
secp_ctx: &Secp256k1<secp256k1::All>,
114122
) -> Result<Signature, ()>;
115123

116124
/// Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
@@ -130,16 +138,18 @@ pub trait TaprootChannelSigner: ChannelSigner {
130138
/// detected onchain. It has been generated by our counterparty and is used to derive
131139
/// channel state keys, which are then included in the witness script and committed to in the
132140
/// BIP 341 signature.
133-
fn sign_counterparty_htlc_transaction(&self, htlc_tx: &Transaction, input: usize, amount: u64,
134-
per_commitment_point: &PublicKey, htlc: &HTLCOutputInCommitment,
135-
secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()>;
141+
fn sign_counterparty_htlc_transaction(
142+
&self, htlc_tx: &Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey,
143+
htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<secp256k1::All>,
144+
) -> Result<Signature, ()>;
136145

137146
/// Create a signature for a (proposed) closing transaction.
138147
///
139148
/// Note that, due to rounding, there may be one "missing" satoshi, and either party may have
140149
/// chosen to forgo their output as dust.
141-
fn partially_sign_closing_transaction(&self, closing_tx: &ClosingTransaction,
142-
secp_ctx: &Secp256k1<secp256k1::All>) -> Result<PartialSignature, ()>;
150+
fn partially_sign_closing_transaction(
151+
&self, closing_tx: &ClosingTransaction, secp_ctx: &Secp256k1<secp256k1::All>,
152+
) -> Result<PartialSignature, ()>;
143153

144154
/// Computes the signature for a commitment transaction's anchor output used as an
145155
/// input within `anchor_tx`, which spends the commitment transaction, at index `input`.

0 commit comments

Comments
 (0)