From baa37c345cc46a5c2f8ba04f2076b07e73fc5395 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 15 Oct 2019 14:59:36 -0400 Subject: [PATCH] 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 --- src/wallet/wallet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index f4aa3e22f8..42ff8da965 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #ifdef USE_BDB #include #endif @@ -3150,6 +3149,7 @@ static bool IsCurrentForAntiFeeSniping(interfaces::Chain& chain) */ static uint32_t GetLocktimeForNewTransaction(interfaces::Chain& chain) { + uint32_t const height = chain.getHeight().value_or(-1); uint32_t locktime; // 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 // nLockTime that preclude a fix later. if (IsCurrentForAntiFeeSniping(chain)) { - locktime = chain.getHeight().value_or(-1); + locktime = height; // Secondly occasionally randomly pick a nLockTime even further back, so // that transactions that are delayed after signing for whatever reason, @@ -3187,7 +3187,7 @@ static uint32_t GetLocktimeForNewTransaction(interfaces::Chain& chain) locktime = 0; } - assert(locktime <= (unsigned int)::ChainActive().Height()); + assert(locktime <= height); assert(locktime < LOCKTIME_THRESHOLD); return locktime; }