Skip to content
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

Proper handling of gossiped channels being spent #838

Merged
merged 4 commits into from
Jan 31, 2019
Merged

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Jan 28, 2019

While it makes sense to exclude from the routing table channels for
which there is a spending tx in the mempool, we shouldn't blame our
peers for considering the channel still opened if the spending tx hasn't
yet been confirmed.

Also, reworked ValidateResult with better types. It appears that the
NonexistingChannel error wasn't really useful (a malicious peer would
probably point to an existing funding tx, so there is no real difference
between "txid not found" and "invalid script"), so it was replaced by
InvalidAnnouncement error which is a more serious offense (punished
by a disconnection, and probably a ban when we implement that sort of
things).

@pm47 pm47 requested a review from sstone January 28, 2019 15:40
While it makes sense to exclude from the routing table channels for
which there is a spending tx in the mempool, we shouldn't blame our
peers for considering the channel still opened if the spending tx hasn't
yet been confirmed.

Also, reworked `ValidateResult` with better types. It appears that the
`NonexistingChannel` error wasn't really useful (a malicious peer would
probably point to an existing funding tx, so there is no real difference
between "txid not found" and "invalid script"), so it was replaced by
`InvalidAnnouncement` error which is a more serious offense (punished
by a disconnection, and probably a ban when we implement that sort of
things).
@pm47 pm47 force-pushed the validate-mempool branch from b725826 to e368770 Compare January 28, 2019 15:45
case object Unspent extends UtxoStatus
case object Spent extends UtxoStatus
case object SpentAndSpendingTxConfirmed extends UtxoStatus
}
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: why not case class Spent(confirmed:Boolean) instead ?

@pm47 pm47 merged commit 1da0017 into master Jan 31, 2019
@pm47 pm47 deleted the validate-mempool branch January 31, 2019 15:03
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