-
Notifications
You must be signed in to change notification settings - Fork 406
Move spendable output descriptors key behind signer interface #562
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
Move spendable output descriptors key behind signer interface #562
Conversation
@@ -469,6 +472,18 @@ impl ChannelKeys for InMemoryChannelKeys { | |||
Ok(secp_ctx.sign(&sighash, &self.funding_key)) | |||
} | |||
|
|||
fn sign_delayed_transaction<T: secp256k1::Signing>(&self, spend_tx: &mut Transaction, input: usize, witness_script: &Script, amount: u64, per_commitment_point: &PublicKey, secp_ctx: &Secp256k1<T>) { |
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.
the witness_script
could be derived here rather than passed in, if I'm not mistaken
@@ -469,6 +472,18 @@ impl ChannelKeys for InMemoryChannelKeys { | |||
Ok(secp_ctx.sign(&sighash, &self.funding_key)) | |||
} | |||
|
|||
fn sign_delayed_transaction<T: secp256k1::Signing>(&self, spend_tx: &mut Transaction, input: usize, witness_script: &Script, amount: u64, per_commitment_point: &PublicKey, secp_ctx: &Secp256k1<T>) { | |||
if let Ok(htlc_key) = chan_utils::derive_private_key(&secp_ctx, &per_commitment_point, &self.delayed_payment_base_key) { |
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.
failing here likely indicates a serious internal error, so should propagate the error to the caller
@@ -484,6 +488,19 @@ impl ChannelKeys for InMemoryChannelKeys { | |||
} | |||
} | |||
|
|||
fn sign_payment_transaction<T: secp256k1::Signing>(&self, spend_tx: &mut Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey, network: Network, secp_ctx: &Secp256k1<T>) { |
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.
see two comments on sign_delayed_transaction
b8db1a7
to
81bc09a
Compare
Codecov Report
@@ Coverage Diff @@
## master #562 +/- ##
========================================
Coverage 91.10% 91.10%
========================================
Files 34 34
Lines 20447 20565 +118
========================================
+ Hits 18628 18736 +108
- Misses 1819 1829 +10
Continue to review full report at Codecov.
|
…TxCache Used in next commits to avoid passing script between ChannelMonitor and OnchainTxHandler. ChannelMonitor duplicata will be removed in future commits.
As we can't predict if any and which revoked commitment tx is going to appear onchain we have by design to cache all htlc information to regenerate htlc script if needed.
As we cache more and more transaction elements in OnchainTxHandler we should dry up completly InputMaterial until them being replaced directly by InputDescriptor
By moving script generation inside OnchainTxHandler, we may dry-up further ChannelMonitor in next commits.
OnchainTxHandler By moving script generation inside OnchainTxHandler, we may dry-up further ChannelMonitor in next commits
Add sign_delayed_transaction in ChanSigner to be able to spend SpendableOutputDescriptor in test framework.
Add sign_payment_transaction in ChanSigner to be able to spend SpendableOutputDescriptor in test framework
81bc09a
to
7a23c0c
Compare
Closed by #610 |
Build on top of #559 + #560 + #561.
Once merged, we don't have hot private keys anymore in OnchainTxHandler/ChannelMonitor :)