Skip to content

Fix one-confirmation funding_locked generation #491

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
Feb 11, 2020

Conversation

TheBlueMatt
Copy link
Collaborator

Reported by @icota.

We previously tracked funding transaction confirmation by marking
funding_tx_confirmations to 1 when we see it in a block and
incrementing each block thereafter if its non-0. To avoid
double-incrementing the first confirmation, we did the increment
(and funding_locked check) after doing the first-confirmation
checks. Thus, we'd never hit the funding_locked case during the
first confirmation.

To address this, we simply swap the order of the checks, though
bumping the funding_tx_confirmations increment up to the top.

Reported-by: Igor Cota <[email protected]>
Copy link

@ariard ariard left a comment

Choose a reason for hiding this comment

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

ACK ff24530 modulo zero-conf chan support

Thanks @icota nice first contribution :)

if header.bitcoin_hash() != self.last_block_connected {
self.last_block_connected = header.bitcoin_hash();
self.channel_monitor.last_block_hash = self.last_block_connected;
if self.funding_tx_confirmations > 0 {
Copy link

Choose a reason for hiding this comment

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

Do we want to support zero-conf channels ? If so we should remove this check I guess.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, in theory I think we do, but it probably shouldnt be with this API - we should do some kind of risk API that lets you limit exposure to 0confs and such...I havent thought much about how to structure it, yet, though.

@TheBlueMatt TheBlueMatt merged commit 1619d08 into lightningdevkit:master Feb 11, 2020
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