0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-05 10:17:30 -05:00
bitcoin-bitcoin-core/src/wallet
MeshCollider ed40fbb02a
Merge #15741: Batch write imported stuff in importmulti
0db94e55d wallet: Pass WalletBatch to CWallet::UnsetWalletFlag (João Barbosa)
6cb888b37 Apply the batch treatment to CWallet::SetAddressBook via ImportScriptPubKeys (Ben Woosley)
6154a09e0 Move some of ProcessImport into CWallet::Import* (Ben Woosley)
ccb26cf34 Batch writes for importmulti (Andrew Chow)
d6576e349 Have WalletBatch automatically flush every 1000 updates (Andrew Chow)
366fe0be0 Add AddWatchOnlyWithDB, AddKeyOriginWithDB, AddCScriptWithDB functions (Andrew Chow)

Pull request description:

  Instead of writing each item to the wallet database individually, do them in batches so that the import runs faster.

  This was tested by importing a ranged descriptor for 10,000 keys.

  Current master

  ```
  $ time src/bitcoin-cli -regtest -rpcwallet=importbig importmulti '[{"desc": "sh(wpkh([73111820/44h/1h/0h]tpubDDoT2SgEjaU5rerQpfcRDWPAcwyZ5g7xxHgVAfPwidgPDKVjm89d6jJ8AQotp35Np3m6VaysfUY1C2g68wFqUmraGbzhSsMF9YBuTGxpBaW/1/*))#3w7php47", "range": [0, 10000], "timestamp": "now", "internal": true, "keypool": false, "watchonly": true}]'
  ...

  real	7m45.29s
  ```

  This PR:

  ```
  $ time src/bitcoin-cli -regtest -rpcwallet=importbig4 importmulti '[{"desc": "pkh([73111820/44h/1h/0h]tpubDDoT2SgEjaU5rerQpfcRDWPAcwyZ5g7xxHgVAfPwidgPDKVjm89d6jJ8AQotp35Np3m6VaysfUY1C2g68wFqUmraGbzhSsMF9YBuTGxpBaW/1/*)#v65yjgmc", "range": [0, 10000], "timestamp": "now", "internal": true, "keypool": false, "watchonly": true}]'
  ...

  real	3.93s
  ```

  Fixes #15739

ACKs for commit 0db94e:
  jb55:
    utACK 0db94e5
  ariard:
    Tested ACK 0db94e5
  Empact:
    re-utACK 0db94e55dc only change is re the privacy of `UnsetWalletFlagWithDB` and `AddCScriptWithDB`.

Tree-SHA512: 3481308a64c99b6129f7bd328113dc291fe58743464628931feaebdef0e6ec770ddd5c19e4f9fbc1249a200acb04aaf62a8d914d53b0a29ac1e557576659c0cc
2019-05-29 18:54:41 +12:00
..
test scripted-diff: Rename LockAnnotation to LockAssertion 2019-05-17 13:29:04 +02:00
coincontrol.cpp scripted-diff: Move util files to separate directory. 2018-11-04 22:46:07 -08:00
coincontrol.h scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
coinselection.cpp Introduce a Shuffle for FastRandomContext and use it in wallet and coinselection 2018-12-12 14:22:12 -08:00
coinselection.h amount: Move CAmount CENT to unit test header 2018-09-17 14:34:56 -04:00
crypter.cpp scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
crypter.h [tools] Add wallet inspection and modification tool 2019-01-30 16:26:52 -05:00
db.cpp Merge #15741: Batch write imported stuff in importmulti 2019-05-29 18:54:41 +12:00
db.h scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
feebumper.cpp scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
feebumper.h scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
fees.cpp scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
fees.h Remove uses of fee globals in wallet code 2019-02-22 15:43:02 -04:00
init.cpp scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
load.cpp scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
load.h scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
psbtwallet.cpp scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
psbtwallet.h Remove unused TransactionError constants 2019-02-14 10:32:02 -05:00
rpcdump.cpp Merge #15741: Batch write imported stuff in importmulti 2019-05-29 18:54:41 +12:00
rpcwallet.cpp rpc: Mention getwalletinfo where a rescan is triggered 2019-05-22 08:24:54 +01:00
rpcwallet.h Merge #15870: wallet: Only fail rescan when blocks have actually been pruned 2019-05-16 11:18:27 -04:00
wallet.cpp Merge #15741: Batch write imported stuff in importmulti 2019-05-29 18:54:41 +12:00
wallet.h Merge #15741: Batch write imported stuff in importmulti 2019-05-29 18:54:41 +12:00
walletdb.cpp scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
walletdb.h Have WalletBatch automatically flush every 1000 updates 2019-05-18 12:58:50 -04:00
wallettool.cpp Exceptions should be caught by reference, not by value. 2019-05-26 18:35:13 +03:00
wallettool.h scripted-diff: Bump copyright headers in wallet 2019-05-06 14:05:52 -04:00
walletutil.cpp Merge #15870: wallet: Only fail rescan when blocks have actually been pruned 2019-05-16 11:18:27 -04:00
walletutil.h wallet: Add WalletLocation utility class 2018-10-25 11:53:17 +01:00