Commit graph

22273 commits

Author SHA1 Message Date
Wladimir J. van der Laan
cd6cb9745e
Merge #17409: build: Avoid hardcoded libfaketime dir in gitian
333362991c doc: Explain $LIB in LD_PRELOAD in gitian descriptors (MarcoFalke)
fab9850ef4 scripted-diff: Avoid hardcoded libfaketime dir in gitian (MarcoFalke)

Pull request description:

  Without this gitian prints warnings for me:

  ```
  ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
  ```

  ```
  $ ls /usr/lib/aarch64-linux-gnu/faketime/libfaketime.so.1
  /usr/lib/aarch64-linux-gnu/faketime/libfaketime.so.1
  ```

ACKs for top commit:
  laanwj:
    ACK 333362991c

Tree-SHA512: 3e7c4471b69c2ae38c29d0cc0db8b9eae0912085299d7f5ac67eeb4b6a2fdc7eb23d806eeeae0b0c2da22d6d1ba82513cab23652876b97aada9928b2c7d38e7e
2019-11-13 10:20:30 +01:00
NullFunctor
edb6b768a4 fix uninitialized variable nMinerConfirmationWindow
fix uninitialized variable hard code the MinBIP9WarningHeight

fix uninitialized var hard code the MinBIP9WarningHeight instead
2019-11-12 17:59:52 -06:00
Pieter Wuille
d1c02775aa Report amount of data gathered from environment 2019-11-12 15:35:26 -08:00
Pieter Wuille
64e1e022ce Use thread-safe atomic in perfmon seeder
Also switch to chrono based types.
2019-11-12 15:35:26 -08:00
Pieter Wuille
d61f2bb076 Run background seeding periodically instead of unpredictably
* Instead of calling RandAddSeedSleep anytime the scheduler goes
  idle, call its replacement (RandAddSeedPeriodic) just once per
  minute. This has better guarantees of actually being run, and
  helps limit how frequently the dynamic env data is gathered.
* Since this code runs once per minute regardless now, we no
  longer need to keep track of the last time strengthening was
  run; just do it always.
* Make strengthening time context dependent (100 ms at startup,
  10 ms once per minute afterwards).
2019-11-12 15:35:26 -08:00
Pieter Wuille
483b94292e Add information gathered through getauxval()
Suggested by Wladimir van der Laan.
2019-11-12 15:35:26 -08:00
Pieter Wuille
11793ea22e Feed CPUID data into RNG 2019-11-12 15:35:26 -08:00
Pieter Wuille
a81c494b4c Use sysctl for seeding on MacOS/BSD 2019-11-12 15:35:22 -08:00
Pieter Wuille
2554c1b81b Gather additional entropy from the environment
This based on code by Gregory Maxwell.
2019-11-12 15:24:02 -08:00
Pieter Wuille
c2a262a78c Seed randomness with process id / thread id / various clocks
This sort of data is also used by OpenSSL.
2019-11-12 14:50:44 -08:00
Pieter Wuille
723c796667 [MOVEONLY] Move cpuid code from random & sha256 to compat/cpuid 2019-11-12 14:50:44 -08:00
Pieter Wuille
cea3902015 [MOVEONLY] Move perfmon data gathering to new randomenv module 2019-11-12 14:50:44 -08:00
fanquake
b51bae1a5a doc: minor corrections in random.cpp
This should have been part of #17151.
2019-11-12 14:50:44 -08:00
MarcoFalke
8237889e8d
Merge #17435: test: check custom ancestor limit in mempool_packages.py
49997813a4 test: check custom ancestor limit in mempool_packages.py (Sebastian Falbesoner)

Pull request description:

  The functional test `mempool_packages.py` starts one node with default ancestor/descendant limit settings and one with a custom, reduced ancestor limit (currently `-limitancestorcount=5`). The effect of the latter had not been tested yet though. This is approached in this PR by checking on the expected mempool contents of node1 after the node0 ancestor tests are done, via the following three conditions:
  - the # of txs in the node1 mempool is equal to the the limit
  - all txs in node1 mempool are a subset of txs in node0 mempool
  - the node1 mempool txs match the start of the constructed tx-chain

  Note that this still doesn't *fully* check the expected mempool of node1 (e.g. that it isn't influenced by `prioritisetransaction` RPC on node0), hence I add another TODO. In the future it would make sense to also set a custom descendant limit when the second TODO about checking node1's mempool is approached: 89e93135ae/test/functional/mempool_packages.py (L228)

ACKs for top commit:
  MarcoFalke:
    ACK 49997813a4 👲

Tree-SHA512: d3a1d19fb49731238ad08ee7c02e2fa81a227e3b4ef3340d68598de42ddb62be9161134f6b8e08fa76b8c9faa02fecfa01111159642e20e9f358292a757b7608
2019-11-12 14:53:34 -05:00
MarcoFalke
1028882eea
Merge #17437: rpc: Expose block height of wallet transactions
a5e77959c8 rpc: Expose block height of wallet transactions (João Barbosa)

Pull request description:

  Closes #17296.

ACKs for top commit:
  practicalswift:
    ACK a5e77959c8 -- diff looks correct now (good catch @theStack!)
  theStack:
    ACK a5e77959c8
  ryanofsky:
    Code review ACK a5e77959c8. Changes since last review getblockhash python test fixes, and removing the last hardcoded height

Tree-SHA512: 57dcd0e4e7083f34016bf9cf8ef578fbfde49e882b6cd8623dd1c64716e096e62f6177a4c2ed94f5de304e751fe23fb9d11cf107a86fbf0a3c5f539cd2844916
2019-11-12 14:44:13 -05:00
MarcoFalke
333362991c
doc: Explain $LIB in LD_PRELOAD in gitian descriptors 2019-11-12 12:06:34 -05:00
MarcoFalke
6d4b97cb1c
Merge #17450: util: Add missing headers to util/fees.cpp
b131524137 util: Add missing headers to util/fees.cpp (Hennadii Stepanov)

Pull request description:

ACKs for top commit:
  laanwj:
    code review ACK b131524137
  MarcoFalke:
    ACK b131524
  jnewbery:
    ACK b131524137

Tree-SHA512: a1ad36bff12219912c6aaacd7d9dcbeccf0fa3373280fa6e804d7a4d267b485433d6e1c01134cfa6732d2fb30ec1ab4629dff6e4bea2fe4c1976180064a3c6ca
2019-11-12 09:53:04 -05:00
Hennadii Stepanov
b131524137
util: Add missing headers to util/fees.cpp 2019-11-12 09:30:52 +02:00
João Barbosa
3c2c439dcd wallet: Make -walletdir network only 2019-11-12 00:16:17 +00:00
João Barbosa
a5e77959c8 rpc: Expose block height of wallet transactions 2019-11-11 22:32:44 +00:00
Sebastian Falbesoner
49997813a4 test: check custom ancestor limit in mempool_packages.py
To test the custom ancestor limit on node1 (passed by the argument
-limitancestorcount), we check for three conditions:
    -> the # of txs in the node1 mempool is equal to the the limit
    -> all txs in node1 mempool are a subset of txs in node0 mempool
    -> the node1 mempool txs match the start of the constructed tx-chain
2019-11-11 22:37:00 +01:00
MarcoFalke
faffa7f0dc
wallet: Avoid showing GUI popups on RPC errors (take 2) 2019-11-11 13:50:26 -05:00
MarcoFalke
80fdb6fad1
Merge #17442: fix Typo: "merkelRoot" -> "merkleRoot"
eb880f092b fix Typo: "merkelRoot" -> "merkleRoot" (ianliu)

Pull request description:

  <!--
  *** Please remove the following help text before submitting: ***

  Pull requests without a rationale and clear improvement may be closed
  immediately.
  -->

  <!--
  Please provide clear motivation for your patch and explain how it improves
  Bitcoin Core user experience or Bitcoin Core developer experience
  significantly:

  * Any test improvements or new tests that improve coverage are always welcome.
  * All other changes should have accompanying unit tests (see `src/test/`) or
    functional tests (see `test/`). Contributors should note which tests cover
    modified code. If no tests exist for a region of modified code, new tests
    should accompany the change.
  * Bug fixes are most welcome when they come with steps to reproduce or an
    explanation of the potential issue as well as reasoning for the way the bug
    was fixed.
  * Features are welcome, but might be rejected due to design or scope issues.
    If a feature is based on a lot of dependencies, contributors should first
    consider building the system outside of Bitcoin Core, if possible.
  * Refactoring changes are only accepted if they are required for a feature or
    bug fix or otherwise improve developer experience significantly. For example,
    most "code style" refactoring changes require a thorough explanation why they
    are useful, what downsides they have and why they *significantly* improve
    developer experience or avoid serious programming bugs. Note that code style
    is often a subjective matter. Unless they are explicitly mentioned to be
    preferred in the [developer notes](/doc/developer-notes.md), stylistic code
    changes are usually rejected.
  -->

  <!--
  Bitcoin Core has a thorough review process and even the most trivial change
  needs to pass a lot of eyes and requires non-zero or even substantial time
  effort to review. There is a huge lack of active reviewers on the project, so
  patches often sit for a long time.
  -->

ACKs for top commit:
  practicalswift:
    ACK eb880f092b but please change from `merkleRootofHashes` to `merkleRootOfHashes`

Tree-SHA512: ada9edceee19da5678bf35e1258163e7102fe176dc5cf40acaa1468fa8b2801494f8bf65d5359dcd0054fbc22f07fdc98d6208cfdb54dd9171fd45c89d71e098
2019-11-11 13:20:27 -05:00
ianliu
eb880f092b fix Typo: "merkelRoot" -> "merkleRoot" 2019-11-12 00:56:05 +08:00
Hennadii Stepanov
cb9d830a00
test: Use proper MAX_SCRIPT_ELEMENT_SIZE 2019-11-11 12:04:48 +02:00
Hennadii Stepanov
402ee706d8
refactor: Use proper MAX_SCRIPT_ELEMENT_SIZE const 2019-11-11 11:51:49 +02:00
MarcoFalke
fa7523d3aa
ci: Extend docs 2019-11-10 22:30:13 -05:00
MarcoFalke
9999a79074
travis: Rework CACHE_ERR_MSG 2019-11-10 21:49:32 -05:00
MarcoFalke
a6f6333ba2
Merge #17416: Appveyor improvement - text file for vcpkg package list
29eb039252 Moves vcpkg list to a text file and updates the appveyor job and readme to use it. (Aaron Clauson)

Pull request description:

  #17364 attempted to save a couple of minutes by skipping the `vcpkg` steps if the vcpkg install directory was already cached.

  The discussion in #15382 highlights the approach used in #17364 does not accommodate adding a new package.

  ~~This PR improves the approach to individually check whether  each vcpg package is installed rather than checking for the existence of the vcpkg install directory.~~

  This PR moves the list of required vcpkg packages into a separate file and uses changes to that file to invalidate the appveyor cache. Whenever the cache is invalidated the vcpkg sources will be updated, the vcpkg binary built and the required packages installed from the latest port files.

ACKs for top commit:
  MarcoFalke:
    ACK 29eb039252

Tree-SHA512: 0c2a170f4e4b47ca0f9cef14f1e3892001b441a6d84f50bf5fd8a26bc4cdbd9358dfce7ef180d37150262e849650e9857d6b2bcd686964b963c3de6cd708a2f3
2019-11-10 21:42:10 -05:00
TheCharlatan
0ec967164f
Add TheCharlatan's pgp key 2019-11-10 21:43:50 +01:00
Aaron Clauson
29eb039252
Moves vcpkg list to a text file and updates the appveyor job and readme to use it. 2019-11-10 13:49:28 +00:00
Wladimir J. van der Laan
89e93135ae
Merge #17427: qt: Fix missing qRegisterMetaType for size_t
1828c6f05f refactor: Styling w/ clang-format, comment update (Hennadii Stepanov)
88a94f7bb8 qt: Fix missing qRegisterMetaType for size_t (Hennadii Stepanov)

Pull request description:

  On master (a7aec7ad97) this connection a7aec7ad97/src/qt/rpcconsole.cpp (L587) fails due to `ClientModel::mempoolSizeChanged()` signal has unregistered parameter type `size_t`: a7aec7ad97/src/qt/clientmodel.h (L102)

  More:
  ```
  $ QT_FATAL_WARNINGS=1 lldb src/qt/bitcoin-qt -- -debug=qt
  ...
  (lldb) bt
  * thread #17, name = 'QThread', stop reason = signal SIGABRT
    * frame #0: 0x00007ffff35fce97 libc.so.6`__GI_raise(sig=2) at raise.c:51
      frame #1: 0x00007ffff35fe801 libc.so.6`__GI_abort at abort.c:79
      frame #2: 0x00007ffff5901352 libQt5Core.so.5`QMessageLogger::warning(char const*, ...) const + 354
      frame #3: 0x00007ffff5b216fe libQt5Core.so.5`___lldb_unnamed_symbol2329$$libQt5Core.so.5 + 334
      frame #4: 0x00007ffff5b2456d libQt5Core.so.5`QMetaObject::activate(QObject*, int, int, void**) + 1933
      frame #5: 0x000055555566872e bitcoin-qt`ClientModel::mempoolSizeChanged(this=<unavailable>, _t1=<unavailable>, _t2=<unavailable>) at moc_clientmodel.cpp:260
  ...

  ```

  `debug.log`:
  ```
  [] GUI: QObject::connect: Cannot queue arguments of type 'size_t'
  (Make sure 'size_t' is registered using qRegisterMetaType().)
  ```

  This PR fixes it.

  Refs:
  - [Qt docs: qRegisterMetaType](https://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType)
  - #16348

  ---

  Side NOTE: Also I believe this line a7aec7ad97/src/qt/bitcoin.cpp (L63) is redundant since long `CAmount` is a `typedef`.

ACKs for top commit:
  laanwj:
    Tested ACK 1828c6f05f

Tree-SHA512: 2c7f9fe6a5ae70f2e1dd86b07f95d4b00c85c5706a9d722f063f80beb71880d012ec46556963fb1544c2af53d006936c2f7612eae60d9193f67db62ba3d86129
2019-11-10 11:38:53 +01:00
Wladimir J. van der Laan
ecc1a4ecd0
Merge #17431: Remove unnecessary forward declaration
3d133482b2 Remove unnecessary forward declaration (Mark Erhardt)

Pull request description:

  This removes an unnecessary forward declaration.

ACKs for top commit:
  jnewbery:
    Tested ACK 3d133482b2
  laanwj:
    ACK 3d133482b2

Tree-SHA512: 9e5b14e861c2b9fa2d7707ed67c4667540e9812a762e00f5039691eeca82390eb7462d20ad781d4e8c9111517e989da7aef60b112ab33abb774e32d9845b5459
2019-11-10 11:18:10 +01:00
Hennadii Stepanov
1828c6f05f
refactor: Styling w/ clang-format, comment update 2019-11-10 12:11:07 +02:00
Hennadii Stepanov
88a94f7bb8
qt: Fix missing qRegisterMetaType for size_t
It is required in order to use size_t in QueuedConnections.
2019-11-10 12:03:53 +02:00
Wladimir J. van der Laan
cef7df37ce
Merge #17410: Rename db log category to walletdb (like coindb)
e2c03c1156 doc: Add relase note for db→walletdb rename (Wladimir J. van der Laan)
4c1d263d93 scripted-diff: Change `BCLog::DB` to `BCLog::WALLETDB` (Wladimir J. van der Laan)
6b42b3ba90 Rename `db` log category to `walletdb` (like `coindb`) (Wladimir J. van der Laan)

Pull request description:

  Rename the `db` log category to `walletdb` (in the style of, and to distinguish from `coindb`). Deprecate (but still accept) '-debug=db'.

  Second commit is a scripted commit that changes the enum item name.

ACKs for top commit:
  hebasto:
    ACK e2c03c1156, tested on Linux Mint 19.2:

Tree-SHA512: a044de6f9a70e735cbb1caa4ed6bf75bc2269b2d5bc3241a25b6a6d69c1fc1d83456e252b431388ae61f4821e4fc06ecc1b634816ceadbe9a3c0e494bee6c11e
2019-11-10 10:50:58 +01:00
Mark Erhardt
3d133482b2
Remove unnecessary forward declaration 2019-11-09 22:08:29 -08:00
MarcoFalke
fa493ef088
ci: Make ci system read-only on the git work tree 2019-11-09 09:13:41 -05:00
MarcoFalke
fab1333292
ci: Remove git from required packages on host 2019-11-09 09:12:24 -05:00
MarcoFalke
fa00393bce
ci: Make all filesystem operations inside docker 2019-11-09 09:11:32 -05:00
Wladimir J. van der Laan
a7aec7ad97
Merge #15934: Merge settings one place instead of five places
083c954b02 Add settings_tests (Russell Yanofsky)
7f40528cd5 Deduplicate settings merge code (Russell Yanofsky)
9dcb952fe5 Add util::Settings struct and helper functions. (Russell Yanofsky)
e2e37cfe8a Remove includeconf nested scope (Russell Yanofsky)
5a84aa880f Rename includeconf variables for clarity (Russell Yanofsky)
dc8e1e7548 Clarify emptyIncludeConf logic (Russell Yanofsky)

Pull request description:

  This is a refactoring-only change that makes it easier to add a new settings source.

  This PR doesn't change behavior. The [`util_ArgsMerge`](deb2327b43/src/test/util_tests.cpp (L626-L822)) and [`util_ChainMerge`](deb2327b43/src/test/util_tests.cpp (L843-L924)) tests added in #15869 and #15988 were written specifically to confirm that ArgsManager settings are parsed, merged, and returned the same way before and after this change.

  This change:

  - Makes it easier to add new settings sources that can get merged with existing sources (see 70675c3e4975203ad6222ba2b00c83b4e4213793 from #15935).
  - Separates parsing of settings from merging of settings, and deduplicates merging code so it doesn't happen five different places ([GetArg](c459c5f701/src/util/system.cpp (L221-L244)), [GetNetBoolArg](c459c5f701/src/util/system.cpp (L255-L261)), [GetArgs](c459c5f701/src/util/system.cpp (L460-L467)), [IsArgNegated](c459c5f701/src/util/system.cpp (L482-L491)), [GetUnsuitableSectionOnlyArgs](c459c5f701/src/util/system.cpp (L343-L352))) in inconsistent ways.
  - Documents and tests current strange merging behaviors, so they be cleaned up in the future if resulting code simplifications and UX improvements warrant loss of backwards compatibility. The newly documented behaviors are: command line [ignored arguments](69d44f3cc7/src/util/system.cpp (L323-L326)) and [more ignored arguments](69d44f3cc7/src/util/settings.cpp (L67-L72)), and config file [reverse precedence](69d44f3cc7/src/util/settings.cpp (L61-L65)), [inconsistently applied top-level settings](69d44f3cc7/src/util/settings.cpp (L55-L59)), and [zombie values](69d44f3cc7/src/util/settings.cpp (L101-L108)).

  The original motivation for this change was to make it easy to add a new persistent setting source without introducing more bugs and inconsistencies. Two commits building on top of this to add a persistent `-wallet` setting are pretty straightforward and show how the new code can be extended:

  * 70675c3e4975203ad6222ba2b00c83b4e4213793 from #15935 – _Add \<datadir>/settings.json persistent settings storage_
  * 04c80c40df9fc6f4734ba238ea7f65607cf88089 from #15937 – _Add loadwallet and createwallet RPC load_on_startup options_

ACKs for top commit:
  ariard:
    ACK 083c954
  jnewbery:
    ACK 083c954b02
  jamesob:
    ACK 083c954b02

Tree-SHA512: 5d106746a44d64d3963c4ef3f4a2fa668a4bedcc9018d3ea12c86beae2fda48a0b036241665837f68685712366f70f2e1faba84d193fa1f456013503097b7659
2019-11-08 23:23:08 +01:00
Wladimir J. van der Laan
adceca2ba5
Merge #17422: doc: add historical 0.19.0 release notes
fec230edcc doc: add historical 0.19.0 release notes (fanquake)

Pull request description:

ACKs for top commit:
  laanwj:
    ACK fec230edcc

Tree-SHA512: c0c83cd357e58acb7969b02a607fb6b40536f1c1072c25f58b0c6b6b9f50372f33403db51e846456b0f3f1cb3782a0b5c60604cb81e11a2cb99af664249c9069
2019-11-08 23:20:56 +01:00
Wladimir J. van der Laan
e2c03c1156 doc: Add relase note for db→walletdb rename 2019-11-08 23:05:47 +01:00
fanquake
fec230edcc
doc: add historical 0.19.0 release notes 2019-11-08 16:20:37 -05:00
Wladimir J. van der Laan
9e0aabe50c
Merge #17367: ci: Run non-cross-compile builds natively
faf757a125 ci: Guess the native host when not cross compiling (MarcoFalke)
fa8a60bce9 ci: Run non-cross-compile builds natively (MarcoFalke)
fa56bcbb01 ci: Run CI_WAIT only on travis (MarcoFalke)

Pull request description:

  non-cross-compile ci builds should not hardcode an architecture, so they can be run on any ci system

ACKs for top commit:
  laanwj:
    re-ACK faf757a125

Tree-SHA512: 97f86ad411e98c6317a62f829bee26c16dbe3fa54d8ac013018f7669b653d7d6d750740b2ecfb7175195d5fffc701ce503b0d11802b97af30904b51bb23f2073
2019-11-08 22:09:31 +01:00
Wladimir J. van der Laan
4c1d263d93 scripted-diff: Change BCLog::DB to BCLog::WALLETDB
-BEGIN VERIFY SCRIPT-
git grep -l "BCLog::DB" src | xargs sed -i "s/BCLog::DB/BCLog::WALLETDB/g"
sed -i "s/DB          =/WALLETDB    =/g" src/logging.h
-END VERIFY SCRIPT-
2019-11-08 18:45:38 +01:00
Wladimir J. van der Laan
6b42b3ba90 Rename db log category to walletdb (like coindb)
Deprecate (but still accept) '-debug=db'.
2019-11-08 18:28:26 +01:00
fanquake
8021392b82
Merge #17405: wallet: Remove unused boost::this_thread::interruption_point
fad1de66a2 wallet: Remove unused boost::this_thread::interruption_point (MarcoFalke)

Pull request description:

  `BerkeleyEnvironment::Open` is only called from the main thread (init) or an http rpc thread, neither of which can be interrupted, so remove the useless interruption point.

  `BerkeleyEnvironment{}` is only used in tests, which run in a single process/thread, so remove the useless interruption point.

ACKs for top commit:
  laanwj:
    ACK fad1de66a2
  fanquake:
    ACK fad1de66a2

Tree-SHA512: dacd8398e966e4a6ce5cf7d3ed821c9c267eff40b14c0635085441647cdb72d1642807f89355419f1710f814c7963e35a10d102d0b985c7198261dfc736256f8
2019-11-08 09:01:09 -05:00
fanquake
4a3b6f47cd
Merge #17354: wallet: Tidy CWallet::SetUsedDestinationState
0b75a7f068 wallet: Reuse existing batch in CWallet::SetUsedDestinationState (João Barbosa)
01f45dd00e wallet: Avoid recursive lock in CWallet::SetUsedDestinationState (João Barbosa)

Pull request description:

  This PR makes 2 distinct changes around `CWallet::SetUsedDestinationState`:
   - 1st the recursive lock is removed and now it requires the lock to be held;
   - 2nd change is to support, in the best case, just a wallet database flush when transaction is added to the wallet.

ACKs for top commit:
  achow101:
    ACK 0b75a7f068
  MarcoFalke:
    ACK 0b75a7f068
  ryanofsky:
    Code review ACK 0b75a7f068. Code changes looks fine but PR description should be updated to say what benefits of the change are. I might have missed something, but I didn't see a place where multiple batches were used previously and a single batch was used now. So the main benefit of this change appears to be removing a recursive lock? And maybe moving toward a consistent convention for passing batch instances?

Tree-SHA512: abcf23a5850d29990668db20d6f624cca3e89629cc9ed003e0d05cde1b58ab2ff365034f156684ad13e55764b54c6c0c2bc7d5f96b8af7dc5e45a3be955d6b15
2019-11-08 08:44:49 -05:00
Samuel Dobson
99ab3a72c5
Merge #15931: Remove GetDepthInMainChain dependency on locked chain interface
36b68de5b2 Remove getBlockDepth method from Chain::interface (Antoine Riard)
b66c429c56 Remove locked_chain from GetDepthInMainChain and its callers (Antoine Riard)
0ff03871ad Use CWallet::m_last_block_processed_height in GetDepthInMainChain (Antoine Riard)
f77b1de16f Only return early from BlockUntilSyncedToCurrentChain if current tip is exact match (Antoine Riard)
769ff05e48 Refactor some importprunedfunds checks with guard clause (Antoine Riard)
5971d3848e Add block_height field in struct Confirmation (Antoine Riard)
9700fcb47f Replace CWalletTx::SetConf by Confirmation initialization list (Antoine Riard)
5aacc3eff1 Add m_last_block_processed_height field in CWallet (Antoine Riard)
10b4729e33 Pass block height in Chain::BlockConnected/Chain::BlockDisconnected (Antoine Riard)

Pull request description:

  Work starter to remove Chain::Lock interface by adding m_last_block_processed_height in CWallet and m_block_height in CMerkleTx to avoid GetDepthInMainChain having to keep a lock . Once this one done, it should ease work to wipe out more cs_main locks from wallet code.

  I think it's ready for a first round of review before to get further.

  - `BlockUntilSyncedToCurrent` : restrain isPotentialTip to isTip because we want to be sure that wallet see BlockDisconnected callbacks if its height differs from the Chain one. It means during a reorg, an RPC could return before the BlockDisconnected callback had been triggered. This could cause a tx that had been included in the disconnected block to be displayed as confirmed, for example.

  ~~- `AbandonTransaction` : in case of conflicted tx (nIndex = -1), we set its m_block_height to the one of conflicting blocks, but if this height is superior to CWallet::m_last_block_processed_height, that means tx isn't conflicted anymore so we return 0 as tx is again unconfirmed~~ After #16624, we instead rely on Confirmation.

  ~~- `AddToWalletIfInvolvingMe`: in case of block disconnected, transactions are added to mempool again, so we need to replace old txn in `mapWallet` with a height set to zero so we remove check on block_hash.IsNull~~ Already done in #16624

ACKs for top commit:
  jnewbery:
    @jkczyz you've ACKed an intermediate commit (github annoyingly orders commits in date order, not commit order). Did you mean to ACK the final commit in this branch (36b68de5b2).
  jkczyz:
    > @jkczyz you've ACKed an intermediate commit (github annoyingly orders commits in date order, not commit order). Did you mean to ACK the final commit in this branch ([36b68de](36b68de5b2)).
  meshcollider:
    utACK 36b68de5b2
  ryanofsky:
    Code review ACK 36b68de5b2. Changes since last review: new jkczyz refactor importprunedfunds commit, changed BlockUntilSyncedToCurrentChainChanges commit title and description, changed Confirmation struct field order and line-wrapped comment
  jnewbery:
    utACK 36b68de5b2
  promag:
    Code review ACK 36b68de5b2.

Tree-SHA512: 08b89a0bcc39f67c82a6cb6aee195e6a11697770c788ba737b90986b4893f44e90d1ab9ef87239ea3766508b7e24ea882b7199df41173ab27a3d000328c14644
2019-11-08 23:23:14 +13:00