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

multi: fix chain notif. blocking by pmt processor. #324

Merged
merged 6 commits into from May 14, 2021

Conversation

dnldd
Copy link
Member

@dnldd dnldd commented Apr 25, 2021

This fixes chain notification messages being blocked by payment processing calls when tx confirmations are not accurately being reported.

The fix includes:

  • ensuring a payment processing call concludes before starting another one via the processing flag.

  • calling the payment process in a goroutine to avoid blocking the chain state process.

  • keeping track of tx confirmation failures and starting a wallet rescan if the failures exceed threshold.

Associated tests have been updated.

pool/paymentmgr.go Show resolved Hide resolved
pool/paymentmgr.go Outdated Show resolved Hide resolved
pool/paymentmgr.go Show resolved Hide resolved
pool/chainstate.go Outdated Show resolved Hide resolved
This incorporates wallet rescanning into the
payment process to restore tx conf functionality
when the wallet gets into an error state. Associated
tests have been added.
@dnldd dnldd force-pushed the fix_chain_notif_blocking branch from 3e298c1 to cd7a037 Compare May 1, 2021 10:56
This dedicates a lifecycle process for payment
processing and updates the necessary configs.
Payment processing is now triggered via signals
from the chainstate to the payment manager.
Associated tests have been added.
@dnldd dnldd force-pushed the fix_chain_notif_blocking branch from cd7a037 to 3260806 Compare May 1, 2021 22:16
@jholdstock
Copy link
Member

Tried deploying the latest, along with my additional logging, and I'm seeing this:

2021-05-04 13:49:27.865 [TRC] POOL: Requesting tx conf notifications for 18 transactions (stop after 676684)
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL: Got notification with 0 confirmations
2021-05-04 13:49:27.865 [TRC] POOL: 18 coinbases are not confirmed:
2021-05-04 13:49:27.865 [TRC] POOL:     128cb9805fb29af374a755a938eb33848f9f4fe44c108cc3a47eeb1eb598a105
2021-05-04 13:49:27.865 [TRC] POOL:     b3a417c505e9fec327511397390b42e249083ec44ada12896e46e1439dce30c6
2021-05-04 13:49:27.865 [TRC] POOL:     044baa51a549d4a6d350e0ee6fab683f204950c271199eca0a37f38c0894cb9d
2021-05-04 13:49:27.865 [TRC] POOL:     a0ba191745a9b46429c4a9e84d5b521847d60797f1809ba9288a543f4424a504
2021-05-04 13:49:27.865 [TRC] POOL:     48628bf8a39363286360cad41b62ee426780e99b43dfea101f3945f37d25ea35
2021-05-04 13:49:27.865 [TRC] POOL:     e5be2fcf3a6e2015e0e755212ccc744f658585b836eb6bade48836c8c766c671
2021-05-04 13:49:27.865 [TRC] POOL:     c5f9419f567c38220fdfbaf245b0223292a9233a377dffd7215a76e9d0f067d2
2021-05-04 13:49:27.865 [TRC] POOL:     9b6228cce3311c1a00bf95f4d78d59de5e09ec5aa54a002d5d2d84ff7e14095b
2021-05-04 13:49:27.865 [TRC] POOL:     1952eb7463a3b2d147d5abdf47e190a97e12f6bffd3f6c849795fec7fd51458c
2021-05-04 13:49:27.865 [TRC] POOL:     08df22d7ada1e3d18cda26df5ed2de5045f01a05632a6496f803648e32985687
2021-05-04 13:49:27.865 [TRC] POOL:     a5ecb55c4891fa3ddbc39c5cd9a4d49caec1966ad05829a620408cab09fe416f
2021-05-04 13:49:27.865 [TRC] POOL:     b55022510b40befe7ec551ea35cb22a8effa594cad327769c034550cb3a2450e
2021-05-04 13:49:27.865 [TRC] POOL:     227845cec3ed12c2bd15512c48777805b300a71507240a9e5f85fbf94bdae3d8
2021-05-04 13:49:27.865 [TRC] POOL:     cb65f4151e52fb20d4e7c9a1bc64910c5d9ff862ec5325cf730b3c9440e2cb1d
2021-05-04 13:49:27.865 [TRC] POOL:     6d382962125ed768e501b077d0b8be75d0f4e63717ea4b81a82544366b80a4be
2021-05-04 13:49:27.865 [TRC] POOL:     6a61fbf760f5165147227e89afe4a2fb3b3c992a4f1a7278f53b43f3baf46650
2021-05-04 13:49:27.865 [TRC] POOL:     7962b13efb1f579191cfd8a4a83d72b65c74cf1dffc219959b980ae65b4a95d9
2021-05-04 13:49:27.865 [TRC] POOL:     5c2def82127965621ef2f05d6ad39effabd6635628873fc5472945b6473d6920

dnldd added 2 commits May 4, 2021 19:54
This updates the dividend payment process to
get the lowest failing tx conf height to use for the
start of a wallet rescan to ensure all failing tx confs
are covered.
@dnldd dnldd force-pushed the fix_chain_notif_blocking branch from 3260806 to f734f31 Compare May 4, 2021 22:36
pool/hub.go Show resolved Hide resolved
This fixes an issue where the tx hashes sent in the
notification request were duplicates of each other
because of taking slice of the iterator variable. The
stopAfter param was also updated to send over the
correct parameter (conf count) instead of a
block height.
Copy link
Member

@jholdstock jholdstock left a comment

Choose a reason for hiding this comment

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

Completed a thorough review, comments attached.

As we have discussed on Matrix, I am really not a fan of this change because we are adding a large amount of code to work around a bug in dcrwallet, which should really be fixed there. In order to ensure we come back and remove this code later, I would like to propose two things:

  • We add a good, lengthy comment to the code, to explain the dcrwallet bug and why the rescan is necessary.
  • We immediately open a new issue on the dcrpool repo to remove this code as soon as Transaction not spendable dcrwallet#1740 is fixed. It should link to this PR and to the dcrwallet issue for reference.

pool/hub.go Outdated Show resolved Hide resolved
pool/chainstate.go Outdated Show resolved Hide resolved
pool/paymentmgr.go Outdated Show resolved Hide resolved
pool/paymentmgr.go Outdated Show resolved Hide resolved
pool/paymentmgr.go Outdated Show resolved Hide resolved
pool/paymentmgr.go Outdated Show resolved Hide resolved
pool/paymentmgr.go Show resolved Hide resolved
pool/paymentmgr_test.go Outdated Show resolved Hide resolved
pool/paymentmgr_test.go Outdated Show resolved Hide resolved
pool/paymentmgr_test.go Outdated Show resolved Hide resolved
pool/paymentmgr_test.go Outdated Show resolved Hide resolved
@dnldd dnldd force-pushed the fix_chain_notif_blocking branch from c5caa49 to e673794 Compare May 12, 2021 18:40
@dnldd dnldd merged commit 9b9c66f into decred:master May 14, 2021
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.

None yet

2 participants