-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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
rpc, wallet: Scan mempool after import* - Second attempt #25351
Conversation
5e4f269
to
abdaa25
Compare
ACK abdaa25 |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unable to get this to work with descriptor wallets; still seeing the issue I reported in #25453.
Step 1: create a regular descriptor wallet, put some coins in it (I used a Taproot address for this)
Step 2: get one of its the matching receive descriptor s via listdescriptors
Step 3: create a watch-only wallet
Step 4: send coins to self, and before it confirms do:
Step 5: call importdescriptors
on the watch-only wallet, using the above descriptor and some recent timestamp.
It will not add the mempool transaction until you either restart or it confirms.
rescanblockchain
also doesn't add the transaction, but I suppose that's out of scope here.
Update: Note that you DO see the confirmed deposit transaction, but you don't see the outgoing mempool transaction.
src/wallet/test/wallet_tests.cpp
Outdated
@@ -765,7 +765,7 @@ BOOST_FIXTURE_TEST_CASE(CreateWallet, TestChain100Setup) | |||
// being blocked | |||
wallet = TestLoadWallet(context); | |||
BOOST_CHECK(rescan_completed); | |||
BOOST_CHECK_EQUAL(addtx_count, 2); | |||
BOOST_CHECK_EQUAL(addtx_count, 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a43ee48: maybe add a comment to explain what those 3 transactions are: 2 m_coinbase_txns
entries and mempool_tx
?
I'm confused why it's 3 here and 5 below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a43ee48: maybe add a comment to explain what those 3 transactions are: 2 m_coinbase_txns entries and mempool_tx?
I'm confused why it's 3 here and 5 below.
Agreed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I see what you mean. The TestLoadWallet()
helper function had a call to postInitProcess()
which meant that the mempool was checked twice. Removing that led to the numbers in the CreateWallet
test being much more sensible and there seem to be no other negative effects from that change. At least the test isn't failing and I also didn't see any other reason to keep it. I added some comments as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO bumping the numbers was better. :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO bumping the numbers was better. :/
Could you say why you like it better? When the numbers are bumped I feel they don't match what the test is doing and I would need to add more comments to explain why this is the case. Hence it seemed like the better choice to me. Also curious to hear your feedback here @w0xlt and @Sjors :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it would be undefined behaviour (between modules) to skip postInitProcess
.
Counting AddToWallet calls might be too low-level to be a good test, but that seems out of scope here IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no strong feelings about this, as long as it's clear from the code documentation where the transactions are coming from.
@Sjors I was able to retrieve the mempool transactions by following these steps on regtest and signet. |
Mmm, and without this PR you're able to reproduce the original issue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK abdaa25
Some nits:
src/wallet/test/wallet_tests.cpp
Outdated
@@ -765,7 +765,7 @@ BOOST_FIXTURE_TEST_CASE(CreateWallet, TestChain100Setup) | |||
// being blocked | |||
wallet = TestLoadWallet(context); | |||
BOOST_CHECK(rescan_completed); | |||
BOOST_CHECK_EQUAL(addtx_count, 2); | |||
BOOST_CHECK_EQUAL(addtx_count, 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a43ee48: maybe add a comment to explain what those 3 transactions are: 2 m_coinbase_txns entries and mempool_tx?
I'm confused why it's 3 here and 5 below.
Agreed.
@Sjors Yes, without this PR (using the master branch), I am able to reproduce the issue. |
@Sjors and your second wallet was a watch-only wallet? Guess I'll have to retry to check my own sanity :-) |
@Sjors the watch-only was created with |
abdaa25
to
8f59d58
Compare
Addressed feedback but have yet to go through @Sjors steps to see if I can reproduce his issue. |
I redid the experiment and clarified the procedure a bit. Oops, I managed to run an earlier build of QT, because I reconfigred using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 8f59d58
(though I only manually tested with a taproot descriptor)
co-authored-by: Fabian Jahr <fjahr@protonmail.com>
co-authored-by: Fabian Jahr <fjahr@protonmail.com>
Addressed feedback from @luke-jr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reACK 1be7964
re-utACK 1be7964 (only a test change) |
ACK 1be7964 |
… attempt 1be7964 test, wallet: Add mempool rescan test for import RPCs (Fabian Jahr) 833ce76 rpc, wallet: Document mempool rescan after importdescriptor, importwallet (Fabian Jahr) 0e396d1 rpc, wallet: Document mempool scan after importmulti (Fabian Jahr) e6d3ef8 rpc, wallet: Document mempool scan after importpubkey (Fabian Jahr) 6d3db52 rpc, wallet: Document and test mempool scan after importprivkey (João Barbosa) 3abdbbb rpc, wallet: Document and test mempool scan after importaddress (João Barbosa) 236239b wallet: Rescan mempool for transactions as well (Fabian Jahr) Pull request description: This PR picks up the work from bitcoin#18964 and closes bitcoin#18954. It should incorporate all the unaddressed feedback from the PR: - Mempool rescan now expanded to all relevant import* RPCs - Added documentation in the help of each RPC - More tests ACKs for top commit: Sjors: re-utACK 1be7964 (only a test change) achow101: ACK 1be7964 w0xlt: reACK bitcoin@1be7964 Tree-SHA512: b62fed5f97c6c242b2af417b41c9696a1f18878483d9e1c9429791f9c05257f57a00540a9a84df23c49faf6a61c3109c22972de81540083f38b506217804fcc5
This PR picks up the work from #18964 and closes #18954.
It should incorporate all the unaddressed feedback from the PR: