-
Notifications
You must be signed in to change notification settings - Fork 411
Split sign_justice_transaction
in two halves
#923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split sign_justice_transaction
in two halves
#923
Conversation
Codecov Report
@@ Coverage Diff @@
## main #923 +/- ##
==========================================
+ Coverage 90.50% 91.15% +0.65%
==========================================
Files 59 59
Lines 29769 32442 +2673
==========================================
+ Hits 26942 29574 +2632
- Misses 2827 2868 +41
Continue to review full report at Codecov.
|
lightning/src/chain/keysinterface.rs
Outdated
@@ -279,8 +279,24 @@ pub trait BaseSign { | |||
#[cfg(any(test,feature = "unsafe_revoked_tx_signing"))] | |||
fn unsafe_sign_holder_commitment_and_htlcs(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<(Signature, Vec<Signature>), ()>; | |||
|
|||
/// Create a signature for the given input in a transaction spending an HTLC or commitment | |||
/// transaction output when our counterparty broadcasts an old state. | |||
/// Create a signature for the given input in a transaction spending a HTLC transction output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spelling "transaction"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also "an HTLC" not "a HTLC". English sucks.
ACK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some spelling and grammar stuff, looks good.
lightning/src/chain/keysinterface.rs
Outdated
@@ -279,8 +279,24 @@ pub trait BaseSign { | |||
#[cfg(any(test,feature = "unsafe_revoked_tx_signing"))] | |||
fn unsafe_sign_holder_commitment_and_htlcs(&self, commitment_tx: &HolderCommitmentTransaction, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<(Signature, Vec<Signature>), ()>; | |||
|
|||
/// Create a signature for the given input in a transaction spending an HTLC or commitment | |||
/// transaction output when our counterparty broadcasts an old state. | |||
/// Create a signature for the given input in a transaction spending a HTLC transction output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also "an HTLC" not "a HTLC". English sucks.
dee518a
to
8b97f1d
Compare
Thanks for review, I think I've addressed all the grammar stuff and took code style suggestion in 8b97f1d |
lightning/src/chain/keysinterface.rs
Outdated
Err(_) => return Err(()) | ||
let revocation_pubkey = chan_utils::derive_public_revocation_key(&secp_ctx, &per_commitment_point, &self.pubkeys().revocation_basepoint).map_err(|_| ())?; | ||
let witness_script = { | ||
let counterparty_delayedpubkey = match chan_utils::derive_public_key(&secp_ctx, &per_commitment_point, &self.counterparty_pubkeys().delayed_payment_basepoint) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: here and a couple more places for .map_err
, but it can also be done in a future PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but did it for some more switches
8b97f1d
to
30a41dd
Compare
To avoid caller data struct storing HTLC-related information when a revokeable output is claimed on top of a commitment/second-stage HTLC transactions, we split `keysinterface::sign_justice_transaction` in two new halves `keysinterfaces::sign_justice_revoked_output` and `keysinterfaces::sign_justice_revoked_htlc`. Further, this split offers more flexibility to signer policy as a commitment revokeable output might be of a value far more significant than HTLC ones.
30a41dd
to
6319690
Compare
To avoid caller data struct storing HTLC-related information when
a revokeable output is claimed on top of a commitment/second-stage
HTLC transactions, we split
keysinterface::sign_justice_transaction
in two new halves
keysinterfaces::sign_justice_revoked_output
andkeysinterfaces::sign_justice_revoked_htlc
.Further, this split offers more flexibility to signer policy as a
commitment revokeable output might be of a value far more significant
than HTLC ones.
Note to reviewers: Should we take opportunity to split further
sign_justice_revoked_output
to enable even better signer policy flexibility (e.g pre-signed transactions for the balance output, key handover for HTLC output w.r.t to watchtower interactions).Required for #642