Merge #17138: Remove wallet access to some node arguments

This backports also includes extra changes that were missing from bitcoin#14711
They are required, otherwise impossible to remove validaion.h dependency as it meant in #17138

b96ed0396294fc4fa89d83ceab6bc169dd09f002 [wallet] Remove pruning check for -rescan option (John Newbery)
eea462de9c652dca556ad241d2126b10790f67f8 [wallet] Remove package limit config access from wallet (John Newbery)

Pull request description:

  Removes wallet access to `-limitancestorcount`, `-limitdescendantcount` and `-prune`:

  - `-limitancestorcount` and `-limitdescendantcount` are now accessed with a method `getPackageLimits` in the `Chain` interface.
  - `-prune` is not required. It was only used in wallet component initiation to prevent running `-rescan` when pruning was enabled. This check is not required.

  Partially addresses #17137.

ACKs for top commit:
  MarcoFalke:
    Tested ACK b96ed0396294fc4fa89d83ceab6bc169dd09f002
  ryanofsky:
    Code review ACK b96ed0396294fc4fa89d83ceab6bc169dd09f002
  promag:
    Code review ACK b96ed0396294fc4fa89d83ceab6bc169dd09f002.
  ariard:
    ACK b96ed03, check there isn't left anymore wallet access to node arguments.

Tree-SHA512: 90c8e3e083acbd37724f1bccf63dab642cf9ae95cc5e684872a67443ae048b4fdbf57b52ea47c5a1da6489fd277278fe2d9bbe95e17f3d4965a1a0fbdeb815bf
This commit is contained in:
MarcoFalke 2019-10-15 14:59:36 -04:00 committed by UdjinM6
parent d82ec8bb6b
commit baa37c345c

View File

@ -33,7 +33,6 @@
#include <util/string.h> #include <util/string.h>
#include <util/translation.h> #include <util/translation.h>
#include <util/validation.h> #include <util/validation.h>
#include <validation.h>
#ifdef USE_BDB #ifdef USE_BDB
#include <wallet/bdb.h> #include <wallet/bdb.h>
#endif #endif
@ -3150,6 +3149,7 @@ static bool IsCurrentForAntiFeeSniping(interfaces::Chain& chain)
*/ */
static uint32_t GetLocktimeForNewTransaction(interfaces::Chain& chain) static uint32_t GetLocktimeForNewTransaction(interfaces::Chain& chain)
{ {
uint32_t const height = chain.getHeight().value_or(-1);
uint32_t locktime; uint32_t locktime;
// Discourage fee sniping. // Discourage fee sniping.
// //
@ -3172,7 +3172,7 @@ static uint32_t GetLocktimeForNewTransaction(interfaces::Chain& chain)
// now we ensure code won't be written that makes assumptions about // now we ensure code won't be written that makes assumptions about
// nLockTime that preclude a fix later. // nLockTime that preclude a fix later.
if (IsCurrentForAntiFeeSniping(chain)) { if (IsCurrentForAntiFeeSniping(chain)) {
locktime = chain.getHeight().value_or(-1); locktime = height;
// Secondly occasionally randomly pick a nLockTime even further back, so // Secondly occasionally randomly pick a nLockTime even further back, so
// that transactions that are delayed after signing for whatever reason, // that transactions that are delayed after signing for whatever reason,
@ -3187,7 +3187,7 @@ static uint32_t GetLocktimeForNewTransaction(interfaces::Chain& chain)
locktime = 0; locktime = 0;
} }
assert(locktime <= (unsigned int)::ChainActive().Height()); assert(locktime <= height);
assert(locktime < LOCKTIME_THRESHOLD); assert(locktime < LOCKTIME_THRESHOLD);
return locktime; return locktime;
} }