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

[bugfix] txnotifier: delete ntfn by confirm height always #4620

Merged
merged 3 commits into from
Sep 16, 2020

Conversation

halseth
Copy link
Contributor

@halseth halseth commented Sep 16, 2020

When we cancel a confirmation request, we should remove the request from
the height map regardless of the current height. Otherwise we end up in
the situation when the height is reached, the notification is attempted
sent which results in a crash.

When we cancel a confirmation request, we should remove the request from
the height map regardless of the current height. Otherwise we end up in
the situation when the height is reached, the notification is attempted
sent which results in a crash.
This test addition would cause the txnotifier to crash prior to the
previous commit.
@@ -763,9 +763,7 @@ func (n *TxNotifier) CancelConf(confRequest ConfRequest, confID uint64) {
if confSet.details != nil {
confHeight := confSet.details.BlockHeight +
ntfn.NumConfirmations - 1
if confHeight <= n.currentHeight {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wpaulino Just to make sure: was this condition here for a good reason?

Copy link
Contributor

Choose a reason for hiding this comment

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

not 100% sure myself, but i think your change is correct. doesn't make sense to continue tracking a canceled request

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like I actually meant to write the opposite condition. If the confirmation height has not been reached, then we should delete it as it hasn't been notified yet to prevent the notification, but if it has, then there's no need to delete it as that's already done once the notification is dispatched. Either way, it should be fine to just always delete now.

Copy link
Contributor

@cfromknecht cfromknecht left a comment

Choose a reason for hiding this comment

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

LGTM 🦘

@@ -763,9 +763,7 @@ func (n *TxNotifier) CancelConf(confRequest ConfRequest, confID uint64) {
if confSet.details != nil {
confHeight := confSet.details.BlockHeight +
ntfn.NumConfirmations - 1
if confHeight <= n.currentHeight {
Copy link
Contributor

Choose a reason for hiding this comment

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

not 100% sure myself, but i think your change is correct. doesn't make sense to continue tracking a canceled request

@@ -763,9 +763,7 @@ func (n *TxNotifier) CancelConf(confRequest ConfRequest, confID uint64) {
if confSet.details != nil {
confHeight := confSet.details.BlockHeight +
ntfn.NumConfirmations - 1
if confHeight <= n.currentHeight {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like I actually meant to write the opposite condition. If the confirmation height has not been reached, then we should delete it as it hasn't been notified yet to prevent the notification, but if it has, then there's no need to delete it as that's already done once the notification is dispatched. Either way, it should be fine to just always delete now.

@cfromknecht cfromknecht merged commit d4d7533 into lightningnetwork:master Sep 16, 2020
@cfromknecht cfromknecht added this to the 0.12.0 milestone Sep 16, 2020
@Roasbeef Roasbeef modified the milestones: 0.12.0, 0.11.1 Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants