Fixes two rare failures that happened in the CI:
#27249: There could be a race with outstanding TxAddedToMempool notifications being applied to the soon-to-be created wallet:
- importdescriptors during rescan sets status to
TxStateConfirmed - old
transactionAddedToMempoolnotification changes status back toTxStateInMempool - If the listunspent call happens here the test will fail
- blockConnected notification will change the status back to
TxStateConfirmed(so it’s not a persistent failure)
I could reproduce this by adding a 100 microsecond sleep to AddToWallet(), the fix is to add a sync, so transactionAddedToMempool notifications won’t affect the new wallet anymore.
#32456:
During init, the test framework will start using rpc after the mempool was loaded.
It will not wait for start() / postInitProcess or outstanding transactionAddedToMempool notifications (which would both set the status to TxStateInMempool), leading to
a possible race, in which listunspent can be called while the tx is still in Inactive status.
Can be reproduced by adding two sleeps: To init before calling start() for the chain clients, plus to transactionAddedToMempool in wallet.cpp.
Prevent this by processing outstanding notifications.