-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Description
I know this issue has been pointed out a few times, but didnt see an issue for it here.
After #7946, if you connect a block, then immediately make some RPC request to get the current block information (eg if you're polling to see when a new block comes in) and then immediately request wallet balance/utxos/etc, the information returned can be up-to-date as of the previous block, not the newly-connected one. This is easy to see in some simple test-cases, and I assume would effect some various use-cases that people might be using in the wild. This is a regression in master, so we should fix it for 0.14.
I think we need to be moving more towards these kinds of callback happening in a background thread anyway, so we have two options - change the API significantly and add some kind of "getwalletchainstate" so that people can wait for wallet to be caught up or add a "sleep until wallet is caught up with chainstate as of entry to RPC function" wrapper to wallet calls.
I generally prefer the second option becuase I think the first will create a somewhat confusing API that people are likely to fuck up, and the sleep should generally never be too long unless your wallet is super slow/too many keys.