bitcoin/src/wallet
Samuel Dobson 6a5381a06b
Merge : wallet, bugfix: fix ComputeTimeSmart function during rescanning process.
240ea294d5 doc: update doxygen documention of ComputeTimeSmart() and AddToWalletIfInvolvingMe() regarding rescanning_old_block parameter (BitcoinTsunami)
d6eb39af21 test: add functional test to check transaction time determination during block rescanning (BitcoinTsunami)
07b44f16e7 wallet: fix ComputeTimeSmart algorithm to use blocktime during old block rescanning (BitcoinTsunami)

Pull request description:

  The function ComputeTimeSmart in wallet.cpp assume that transaction are discovered in the right order.
  Moreover the 'smarttime' determination algorithm is coded with realtime scenario in mind and not rescanning of old block.

  The functional test demonstrate that if the user import a wallet, then rescan only recent history, and then rescan the entire history, the older transaction discovered would have an incorrect time determination.
  In the context of rescanning old block, the only time value that as a meaning is the blocktime.

  That's why I've fixed the problem with a simple separation between rescanning of old block and realtime time determination. The fix is written to have no impact on every realtime scenario and only impact the behaviour during a rescanning process.
  This PR Fixes .

  To be fair, I don't think that this bug could be triggered with the wallet GUI, because it always proceed with a proper rescan.
  But RPC API provide the possibility to trigger it. I've discovered it, because Specter desktop v0.10.0 was impacted. (https://github.com/cryptoadvance/specter-desktop/issues/680).

ACKs for top commit:
  jonatack:
    ACK 240ea294d5 per `git diff b92d552 240ea29`, re-verified rebase to latest master + debug build clean + new test passes on the branch and fails on master, only change since my review a few hours ago is incorporation of latest review suggestions
  meshcollider:
    re-utACK 240ea294d5

Tree-SHA512: 514b02e41d011ddfa325f5e8080b93800e1ea4ed5853fa420670a6ac700e8b463000dbea65f8ced8565cfb950c7f51b69154034dcb111e67aca3b964a0061494
2021-09-29 11:18:23 +13:00
..
test test: Add remaining scenarios of 0 waste 2021-09-24 15:36:58 +05:30
bdb.cpp scripted-diff: Rename overloaded int GetArg to GetIntArg 2021-09-27 06:57:20 -04:00
bdb.h wallet: Add BerkeleyDB version sanity check at init time 2021-01-17 18:10:20 +01:00
coincontrol.cpp refactor: Drop CCoinControl::SetNull 2021-04-18 21:10:47 +01:00
coincontrol.h rpc: include_unsafe option for fundrawtransaction 2021-04-30 18:53:47 +02:00
coinselection.cpp Add SelectCoinsSRD function 2021-09-23 13:33:25 -04:00
coinselection.h Add SelectCoinsSRD function 2021-09-23 13:33:25 -04:00
context.cpp Remove g_rpc_chain global 2020-05-28 02:13:19 -04:00
context.h refactor: remove ::vpwallets and related global variables 2021-08-17 04:05:15 -04:00
crypter.cpp refactor: Replace &foo[0] with foo.data() 2021-05-04 06:55:31 +02:00
crypter.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
db.cpp Merge : wallet: Fix issues when walletdir is root directory 2021-06-09 22:53:36 +12:00
db.h refactor: post Optional<> removal cleanups 2021-03-17 14:56:20 +08:00
dump.cpp refactor: move first run detection to client code 2021-05-19 08:50:16 +02:00
dump.h wallettool: Add createfromdump command 2020-12-16 12:33:06 -05:00
external_signer_scriptpubkeyman.cpp Merge : Basic Taproot signing support for descriptor wallets 2021-06-18 09:12:44 +12:00
external_signer_scriptpubkeyman.h refactor: remove m_internal from DescriptorSPKman 2021-06-30 08:37:50 +02:00
feebumper.cpp refactor: Detach wallet transaction methods (followup for move-only) 2021-09-01 02:22:58 -05:00
feebumper.h wallet: Avoid translating RPC errors when creating txs 2020-05-01 07:39:06 -04:00
fees.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
fees.h Remove uses of fee globals in wallet code 2019-02-22 15:43:02 -04:00
init.cpp Merge : multiprocess: Start using init makeNode, makeChain, etc methods 2021-09-16 08:47:38 +08:00
interfaces.cpp Make GUI UTXO lock/unlock persistent 2021-09-25 23:50:06 +12:00
ismine.h doc: Add developer documentation to isminetype 2021-01-19 19:04:45 +08:00
load.cpp Enable clang-tidy bugprone-argument-comment and fix violations 2021-09-07 09:11:10 +02:00
load.h refactor: remove ::vpwallets and related global variables 2021-08-17 04:05:15 -04:00
receive.cpp refactor: Detach wallet transaction methods (followup for move-only) 2021-09-01 02:22:58 -05:00
receive.h refactor: Detach wallet transaction methods (followup for move-only) 2021-09-01 02:22:58 -05:00
rpcdump.cpp scripted-diff: Rename overloaded int GetArg to GetIntArg 2021-09-27 06:57:20 -04:00
rpcwallet.cpp Merge : Remove -deprecatedrpc=addresses flag and corresponding code/logic 2021-09-29 10:41:30 +13:00
rpcwallet.h refactor: replace util::Ref by std::any (C++17) 2021-03-29 23:29:42 +02:00
salvage.cpp refactor: Replace &foo[0] with foo.data() 2021-05-04 06:55:31 +02:00
salvage.h wallettool: Have RecoverDatabaseFile return errors and warnings 2020-07-26 20:22:45 -04:00
scriptpubkeyman.cpp scripted-diff: Rename overloaded int GetArg to GetIntArg 2021-09-27 06:57:20 -04:00
scriptpubkeyman.h refactor: Remove unused KeyIDHasher 2021-08-22 17:31:58 +02:00
spend.cpp Use SelectCoinsSRD if it has less waste 2021-09-23 13:33:25 -04:00
spend.h refactor: Detach wallet transaction methods (followup for move-only) 2021-09-01 02:22:58 -05:00
sqlite.cpp wallet: refactor: dedup sqlite PRAGMA assignments 2021-05-17 17:22:36 +02:00
sqlite.h doc: fix various typos 2021-01-04 12:31:31 +08:00
transaction.cpp MOVEONLY: CWallet transaction code out of wallet.cpp/.h 2021-05-26 06:32:51 -05:00
transaction.h wallet: refactor: avoid duplicate lookup on mapValue["timesmart"] 2021-09-12 23:41:32 +02:00
wallet.cpp Merge : wallet, bugfix: fix ComputeTimeSmart function during rescanning process. 2021-09-29 11:18:23 +13:00
wallet.h doc: update doxygen documention of ComputeTimeSmart() and AddToWalletIfInvolvingMe() regarding rescanning_old_block parameter 2021-09-28 21:49:35 +02:00
walletdb.cpp Allow locked UTXOs to be store in the wallet database 2021-09-25 23:50:06 +12:00
walletdb.h Allow locked UTXOs to be store in the wallet database 2021-09-25 23:50:06 +12:00
wallettool.cpp refactor: move first run detection to client code 2021-05-19 08:50:16 +02:00
wallettool.h refactor: Move all command dependend checks to ExecuteWalletToolFunc 2021-01-21 19:30:34 +01:00
walletutil.cpp scripted-diff: Replace GetDataDir() calls with gArgs.GetDataDirNet() calls 2021-05-24 10:29:58 +02:00
walletutil.h wallet: Upgrade existing descriptor caches 2021-06-24 13:49:22 -04:00