Skip to content

Add registration of commitment tx's outputs from check_spend_remote_transaction #159

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

Merged
merged 3 commits into from
Sep 8, 2018

Conversation

ariard
Copy link

@ariard ariard commented Sep 7, 2018

Partial fulfilling of #137, simplest design of second suggestion ? Need to be tested when ChannelMonitor logic'll be completed.

pub(super) fn set_funding_info(&mut self, funding_info: (OutPoint, Script)) {
//TODO: Need to register the given script here with a chain_monitor
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to me that registration of given script is already handled in internal_funding_created or funding_transaction_generated by call to add_update_monitor. If self.funding_txo is set, a call to add_update_monitor_by_key is enough.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yea, I think thats fine, but the comment on the ManyChannelMonitor trait should be updated to indicate that this doesn't happen for them!

@ariard
Copy link
Author

ariard commented Sep 7, 2018

"channel_monitor_network_test has been running for over 60 seconds" will investigate on tomorrow (and maybe add test)

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You hit an infinite loop cause the ChainWatchUtil crap doesn't check if a registration is duplicative before calling back into block_connected.

I went ahead and clarified the intended purpose and gave users a bit more flexibility, as well as fixed the infinite loop here at https://github.com/TheBlueMatt/rust-lightning/commits/2018-09-159-clarification-cleanup.

monitor.block_connected(txn_matched, height, &*self.broadcaster);
let outputs = monitor.block_connected(txn_matched, height, &*self.broadcaster);
for output in outputs {
self.chain_monitor.install_watch_script(&output.script_pubkey);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be install_watch_outpoint not script, as script was meant to monitor a specific tx by a random script, not meant to monitor outpoints which is all we need here (the commitment txn are already being monitored). Sorry for the confusion here, I had to go remind myself of what this stuff was for, heh.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah didn't get plainly the distinction! Thanks

@ariard
Copy link
Author

ariard commented Sep 7, 2018

I'd a review on your refactoring, I find it far more clearer this way with ChainWatchedUtil ! Just rebased your commits.
Do you agree with my thoughts on first comment #159 (comment) ?

@TheBlueMatt
Copy link
Collaborator

Responded, thanks! Just squash down the fixup "f" commit and looks good!

TheBlueMatt and others added 3 commits September 8, 2018 02:30
Previously we'd hit an infinite loop if a block_connected call
always resulted in the same ChainWatchInterface registrations.
While we're at it, we also split ChainWatchUtil in two to make
things a bit more flexible for users, though not sure if that
actually matters, and make the matching more aggressive in testing,
even if we pick the more performant option at runtime.
check_spend_remote_transaction

Fixup more descriptive var names by Matt Corallo <[email protected]>
@ariard
Copy link
Author

ariard commented Sep 8, 2018

Rebased, updated with I hope explicitly-enough comments!

@TheBlueMatt TheBlueMatt merged commit 6c07555 into lightningdevkit:master Sep 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants