-
Notifications
You must be signed in to change notification settings - Fork 412
Begin dry-up ChannelMonitor key access #555
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
Begin dry-up ChannelMonitor key access #555
Conversation
Watchtower will be supported through external signer interface where a watchtower implementation may differ from a local one by the scope of key access and pre-signed datas.
1a44317
to
09fae43
Compare
I was kinda OK with it as a dirty hack in #540, but especially if its gonna be its own PR, please dont copy Storage into OnchainTxHandler - everything in it is available in ChannelKeys, co using Storage is just a full copy of it. |
09fae43
to
bd4a7cb
Compare
Rename ChannelMonitor::Storage to OnchainDetection, holder of channel state (base_key+per_commitment_point) to detect onchain transactions accordingly. Going further between splitting detection and transaction generation, we endow OnchainTxHandler with keys access. That way, in latter commits, we may remove secret keys entirely from ChannelMonitor.
Key access is provided through ChanSigner.
check_spend_local_transaction is tasked with detection of onchain local commitment transaction and generate HTLC transaction. Signing an already onchain tx isn't necessary.
bd4a7cb
to
502197d
Compare
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.
Much better than it was so gonna merge. Will follow up with a PR to fix the two comments but it can wait.
|
||
let onchain_detection = OnchainDetection { | ||
keys: keys.clone(), | ||
funding_info: Some(funding_info.clone()), |
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: unnecessary funding_info clone.
revocation_base_key: PublicKey, | ||
htlc_base_key: PublicKey, | ||
} | ||
struct OnchainDetection<ChanSigner: ChannelKeys> { |
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.
I dont think "OnchainDetection" is any better of a name. This should just be flattened and all the fields become a field directly in ChannelMonitor.
Pull some commits out of #540 to ease review process.
This start to separate key access and tx generation material from pure detection even if redeem_script lay between each category.