You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wallet: Imports with pre-existing balance somtimes don't have any balance after a rescan #19808
This bug has been around for a while (at least 0.17 from what I remember) but I guess no one opened an issue for it. I also have been unable to debug this at all.
Sometimes, when importing public keys and scripts which already have a balance, the balance is not detected after the import's rescan finishes. This has particularly occurred with the use of importmulti (but I suspect it should happen with the other import commands, I just don't use those). Even with the timestamp set correctly and with repeated rescans afterwards using rescanblockchain, no balance is found. However later transactions involving those keys and scripts are found.
Attempts to debug this have not been successful as this does not appear to be reproducible (attempts to intentionally reproduce this have failed).
It is possible that this is due to user error (perhaps some timestamp thing), but if that is the case, we should probably remove this footgun.
This issue was also described in an importmulti related PR some time ago. I'm trying to find that comment.
Closing due to lack of interest, progress and direction.
Pull requests with improvements are always welcome. Moreover, it is possible to re-open this issue or create a new issue referencing it, if there is fresh interest.
On a related note, what about adding a checkbalance RPC (or a check argument to the getbalances RPC) to check that the cached balance is correct? It could iterate over the utxo set for the check and then instruct for a rescan to restore missing transaction history and balance?
On a related note, what about adding a checkbalance RPC (or a check argument to the getbalances RPC) to check that the cached balance is correct? It could iterate over the utxo set for the check and then instruct for a rescan to restore missing transaction history and balance?
I don't like that, conceptually. The balance should be correct, and if there are (reproducible) bugs related to that, they should be fixed. Exposing "is the software behaving correctly" RPCs shouldn't be needed if we're confident in the correctness, and adding one anyway makes it hard to reason about expectations for users (when should they turn it on?).
A consistency check, as in an optionally-enabled check that always runs (like -checkmempool and friends) independent from RPC arguments, for debugging purposes, however seems reasonable.
The check wouldn't be used to check that the software is behaving properly, but that the user is behaving properly. For example, when calling importdescriptors, the burden is on the user to supply the correct rescan parameters and the check RPC could help to check that, no?
I suspect my wallet birth date is newer than historical transactions my wallet has, causing it to miss things on reindex, which is a bit odd, but unrelated to this issue
Activity
maflcko commentedon May 1, 2023
Is this still an issue with a recent version of Bitcoin Core? If yes, what are the steps to reproduce?
josibake commentedon May 1, 2023
I am attempting to reproduce this week, will post by the end of the week if I’m successful. If I can’t reproduce, we can probably close
maflcko commentedon May 22, 2023
Closing due to lack of interest, progress and direction.
Pull requests with improvements are always welcome. Moreover, it is possible to re-open this issue or create a new issue referencing it, if there is fresh interest.
maflcko commentedon May 22, 2023
On a related note, what about adding a
checkbalanceRPC (or acheckargument to thegetbalancesRPC) to check that the cached balance is correct? It could iterate over the utxo set for the check and then instruct for arescanto restore missing transaction history and balance?sipa commentedon May 22, 2023
I don't like that, conceptually. The balance should be correct, and if there are (reproducible) bugs related to that, they should be fixed. Exposing "is the software behaving correctly" RPCs shouldn't be needed if we're confident in the correctness, and adding one anyway makes it hard to reason about expectations for users (when should they turn it on?).
A consistency check, as in an optionally-enabled check that always runs (like
-checkmempooland friends) independent from RPC arguments, for debugging purposes, however seems reasonable.maflcko commentedon May 22, 2023
The check wouldn't be used to check that the software is behaving properly, but that the user is behaving properly. For example, when calling
importdescriptors, the burden is on the user to supply the correct rescan parameters and the check RPC could help to check that, no?sipa commentedon May 22, 2023
@MarcoFalke Oh, I see! That's a different matter.
instagibbs commentedon Nov 16, 2023
I think I hit a version of this on 26.0 rc2.
It seems to have found transactions from 2023 in blocks, but nothing prior, leaving everything else "unconfirmed".
edit: ah sorry, this is from a reindex, I'm rescanning as we speak to see if the funds re-appear.
edit2: rescan is resolving in found funds. Is the reindex issue unrelated? Is there another issue?
instagibbs commentedon Nov 16, 2023
sorry, my issue is unrelated since a rescan fixed it:
https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L1466
I suspect my wallet birth date is newer than historical transactions my wallet has, causing it to miss things on reindex, which is a bit odd, but unrelated to this issue