Fix ScanForWalletTransactions to return an enum indicating scan result: success / failure / user_abort#13076
Conversation
25a588a to
821c955
Compare
821c955 to
7b760bc
Compare
7b760bc to
2c4bc00
Compare
src/wallet/wallet.cpp
Outdated
There was a problem hiding this comment.
I think you might want to drop this line and just return true here, to fix the regression described here: #12275 (comment).
There was a problem hiding this comment.
Not sure about that - my inclination is to maintain stricter checking at the risk of spurious failures over less strict checking at the risk of silent failure. How about opening a separate PR for that so it can be considered separately?
3cdfcc3 to
620581f
Compare
src/wallet/wallet.cpp
Outdated
There was a problem hiding this comment.
I'll address this todo in a follow-up.
There was a problem hiding this comment.
Follow-up is here, I'll wait to open until this is accepted:
https://github.com/Empact/bitcoin/tree/rescan-from-time
d922ab0 to
a4f3cb2
Compare
a4f3cb2 to
8bf206b
Compare
|
Dropped explicit values and type from |
8bf206b to
42fad11
Compare
|
Rebased and updated to accommodate #12507. |
42fad11 to
ea9d92b
Compare
8d11f05 to
981adda
Compare
|
@MarcoFalke see the stop_block commit above. Any idea where the test failures are coming from? I don’t see the connection. |
Accurately reports the last block successfully scanned, replacing a return of the chain tip, which represented possibly inaccurated data in a race condition.
981adda to
bd3b036
Compare
|
utACK bd3b036 |
|
utACK bd3b036 |
|
utACK bd3b036 |
…ing scan result: success / failure / user_abort bd3b036 Add stop_block out arg to ScanForWalletTransactions (Ben Woosley) 3002d6c Return a status enum from ScanForWalletTransactions (Ben Woosley) bb24d68 Make CWallet::ScanForWalletTransactions args and return value const (Ben Woosley) Pull request description: Return the failed block as an out arg. Fixes #11450. /cc #12275 Tree-SHA512: 6a523e5425ebfe24e664a942ae21c797ccc1281c25b1bf8d02ad95c19dae343fd8051985ef11853474de7628fd6bed5f15190fbc087c3466ce6fdecab37d72a9
| CBlockIndex* ret = nullptr; | ||
| const CBlockIndex* pindex = pindexStart; | ||
| failed_block = nullptr; | ||
|
|
There was a problem hiding this comment.
Code is not setting stop_block null here, which seems unintended and could lead to uninitialized variables. Would be good to fix this or add documentation if it was done intentionally.
There was a problem hiding this comment.
Ah, right, the code does contradict the comments on line 1634. Will open a PR.
Summary: Partial backport of core [[bitcoin/bitcoin#13076 | PR13076]]: bitcoin/bitcoin@bb24d68 Test Plan: ninja all check Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5561
Summary: ``` Return the failed block as an out var. This clarifies the outcome as the prior return value could be null due to user abort or failure. ``` Partial backport of core [[bitcoin/bitcoin#13076 | PR13076]]: bitcoin/bitcoin@3002d6c Depends on D5561. Test Plan: ninja all check check-functional Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Subscribers: deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5562
Summary: ``` Accurately reports the last block successfully scanned, replacing a return of the chain tip, which represented possibly inaccurated data in a race condition. ``` Completes backport of core [[bitcoin/bitcoin#13076 | PR13076]]: bitcoin/bitcoin@bd3b036 Depends on D5562. Test Plan: ninja all check check-functional Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5563
Summary: Partial backport of core [[bitcoin/bitcoin#13076 | PR13076]]: bitcoin/bitcoin@bb24d68 Test Plan: ninja all check Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5561
Summary: ``` Return the failed block as an out var. This clarifies the outcome as the prior return value could be null due to user abort or failure. ``` Partial backport of core [[bitcoin/bitcoin#13076 | PR13076]]: bitcoin/bitcoin@3002d6c Depends on D5561. Test Plan: ninja all check check-functional Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Subscribers: deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5562
Return the failed block as an out arg.
Fixes #11450.
/cc #12275