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

test: Fix intermittent issue in wallet_backwards_compatibility.py #29982

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Randy808
Copy link
Contributor

When creating and replacing a transaction using bumpfee, an async update is sent in the form of the TransactionAddedToMempool and TransactionRemovedFromMempool signals. When wallet_backwards_compatibility.py creates tx3_id this way and replaces it with tx4_id, the abandontransaction rpc is called right after. In some cases the TransactionAddedToMempool and TransactionRemovedFromMempool is handled after the transaction is abandoned in the wallet, and overwrites the transaction's abandoned flag. This PR forces the signals to get handled before abandontransaction is called by invoking self.sync_mempools which calls syncwithvalidationinterfacequeue on every node's rpc connection.

This will mitigate the immediate inconsistency observed with the abandontransaction call, but the potential race conditions between the signals and wallet operations may also be useful to note in a separate issue (if it's okay to not address it in this one).

Fixes #29806

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 28, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK tdb3

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@DrahtBot DrahtBot added the Tests label Apr 28, 2024
Copy link
Contributor

@tdb3 tdb3 left a comment

Choose a reason for hiding this comment

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

Concept ACK. I would still like to review the logic a bit more. Leaving some test activities as notes for other reviewers:

Tested by performing the following:

Fetched previous releases with test/get_previous_releases.py -b, ran all (non-extended) functional tests (with --previous-releases to prevent skipping). All passed.

As a very quick/basic santity check for intermittency, executed
$ test/functional/test_runner.py --cachedir=/mnt/tmp/cache --tmpdir=/mnt/tmp --filter=wallet_backwards_compatibility --previous-releases
five times. No failures encountered.
Also did this on master (19865a8), but didn't see failures either (I'm making the assumption that the failure is fairly intermittent and is timing dependent).

Performed the reproduction steps described in #29806 (comment) (i.e. commit Randy808@f39144d) on master (i.e. adding delay to callbacks.TransactionAddedToMempool and callbacks.TransactionRemovedFromMempool in validationinterface.cpp with self.sync_mempools() added to wallet_backwards_compatibility.py after node_master.abandontransaction(tx3_id)). The test failed consistently.

Ran without self.sync_mempools() present after node_master.abandontransaction(tx3_id). The test failed in one out five executions.

On the PR branch, added the delays to callbacks.TransactionAddedToMempool and callbacks.TransactionRemovedFromMempool (without self.sync_mempools() added to wallet_backwards_compatibility.py after node_master.abandontransaction(tx3_id)), and the tests passed on each of six events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants