Skip to content

Conversation

@ishaanam
Copy link
Contributor

@ishaanam ishaanam commented Mar 4, 2023

This fixes #26347 (comment)

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 5, 2023

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

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK MarcoFalke, achow101

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #22838 (descriptors: Be able to specify change and receiving in a single descriptor string by achow101)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@fanquake
Copy link
Member

fanquake commented Mar 5, 2023

Is this a draft because you haven't tested under Valgrind yet? Could add to the PR description what needs doing.

@fanquake
Copy link
Member

fanquake commented Mar 5, 2023

Worked for me under a recent Valgrind run.

@ishaanam
Copy link
Contributor Author

ishaanam commented Mar 6, 2023

Is this a draft because you haven't tested under Valgrind yet?

Yes, it was.

Worked for me under a recent Valgrind run.

Great, I will mark it as ready for review.

@ishaanam ishaanam marked this pull request as ready for review March 6, 2023 02:54
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to use the cli, when the normal rpc can be used directly?

Also, I wonder if this introduces another race where the actual rescan in t.start() is scheduled after this call. Avoiding this race might be ugly, but I think it could be possible by using assert_debug_log with a timeout value to sync on the rescan actually starting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any reason to use the cli, when the normal rpc can be used directly?

When I use the normal RPC directly, I get a CannotSendRequest error.

Also, I wonder if this introduces another race where the actual rescan in t.start() is scheduled after this call.

Yes, it does. I have used assert_debug_log with a timeout of 5 to fix this.

@DrahtBot DrahtBot added the Tests label Mar 6, 2023
@ishaanam ishaanam force-pushed the rescanblockchain_test_fix branch from a4278ad to 92777b3 Compare March 6, 2023 15:47
@fanquake
Copy link
Member

Tested 308ea03d95786db674e8cce3e78a56b498cf119a rebased on master (c7f1d95) and I'm no-longer seeing the issue in #27229: wallet_importdescriptors.py --descriptors | ✓ Passed | 652 s

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

Calling the cli constructor does not dispatch the rpc.

Otherwise this looks really nice.

I've tested this with https://github.com/bitcoin/bitcoin/pull/26347/commits/6a5b348f2e526f048d0b448b01f6c4ab608569af#r1133856319

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

looks nice, but there is a bug ACK 308ea03d95786db674e8cce3e78a56b498cf119a 🤠

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: looks nice, but there is a bug ACK 308ea03d95786db674e8cce3e78a56b498cf119a 🤠
dsqqD3bytDg6ZUqhxFkcRuKux2dfw85m+3T2vlhaQUQ3b4l8EkXyTYeSWzPpfL9zx9/SGYpqZiYJTY2x8tWODA==

@ishaanam ishaanam force-pushed the rescanblockchain_test_fix branch from 308ea03 to 78cd77e Compare March 15, 2023 03:36
@maflcko
Copy link
Member

maflcko commented Mar 15, 2023

Didn't re-test. Please advise maintainers if you want this merged or work on coverage for walletpassphrase a bit more (#27199 (comment))

review ACK 78cd77e17719d56366c483d5508cad7b0c5f1b5c 🏟

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: review ACK 78cd77e17719d56366c483d5508cad7b0c5f1b5c 🏟
ubuVZMdV4ZjmXyRCN11JWS3wS1zS8LnQWZZ+XwYwYFJYNWZjDxuYeDZs+qThasZ8axW4+4HoP8NXTP6XZDDECQ==

@ishaanam ishaanam force-pushed the rescanblockchain_test_fix branch from 78cd77e to dbeca79 Compare March 15, 2023 21:28
@maflcko
Copy link
Member

maflcko commented Mar 16, 2023

nice re-ACK dbeca79 🚜

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: nice re-ACK dbeca792a9980085d00be0f9d78187ca3a4d7cdc  🚜
JFDIenhS3ChvBHnr3YgwQFTqW9fJwU4I3gVtjnBatedP3Ch3CrUVWjy/1q1ieBV/KSwz3iW9aEPDNbR0SaAGBA==

@maflcko
Copy link
Member

maflcko commented Mar 16, 2023

Also, tested with my diff from #26347 (comment)

@achow101
Copy link
Member

ACK dbeca79

@achow101 achow101 merged commit db03248 into bitcoin:master Mar 16, 2023
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 17, 2023
…can tests

dbeca79 test: fix race condition in encrypted wallet rescan tests (ishaanam)

Pull request description:

  This fixes bitcoin#26347 (comment)

ACKs for top commit:
  MarcoFalke:
    nice re-ACK dbeca79  🚜
  achow101:
    ACK dbeca79

Tree-SHA512: 7127254ac0274b5bc8ba0242736e77464acbf1f6e3f6af098b4e47742124c336cd67dffdb385e1e8dbd3a8ae74acd073c99e82fa35c44a615fd7d22b29a0daf7
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 17, 2023
…can tests

dbeca79 test: fix race condition in encrypted wallet rescan tests (ishaanam)

Pull request description:

  This fixes bitcoin#26347 (comment)

ACKs for top commit:
  MarcoFalke:
    nice re-ACK dbeca79  🚜
  achow101:
    ACK dbeca79

Tree-SHA512: 7127254ac0274b5bc8ba0242736e77464acbf1f6e3f6af098b4e47742124c336cd67dffdb385e1e8dbd3a8ae74acd073c99e82fa35c44a615fd7d22b29a0daf7
Copy link
Contributor

@mzumsande mzumsande left a comment

Choose a reason for hiding this comment

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

@fanquake
Copy link
Member

@mzumsande see also #27282.

self.nodes[0].cli("-rpcwallet=encrypted_wallet").walletpassphrase("passphrase", 1)

try:
self.nodes[0].cli("-rpcwallet=encrypted_wallet").walletlock()
Copy link
Contributor

@stickies-v stickies-v Mar 23, 2023

Choose a reason for hiding this comment

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

It seems (?) we want this test to fail if walletlock succeeds, but that's not currently the case - is that on purpose? Apologies if I'm misunderstanding, I didn't dive super deep yet so feel free to keep your answer brief.

Edit: I suppose the main difficulty here is that walletlock can succeed if the rescan has already finished by the time walletlock is called, but then I think maybe the test needs a different setup?

Copy link
Contributor Author

@ishaanam ishaanam Mar 23, 2023

Choose a reason for hiding this comment

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

I suppose the main difficulty here is that walletlock can succeed if the rescan has already finished by the time walletlock is called

Yes, this issue here is that the rescan could have finished. For more context see: #27199 (comment)

then I think maybe the test needs a different setup?

It would be great if there was a way that this test could behave the same regardless of speed. We haven't been able to find a way to make that happen yet.

@ishaanam ishaanam deleted the rescanblockchain_test_fix branch November 30, 2023 03:16
@bitcoin bitcoin locked and limited conversation to collaborators Nov 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants