merge bitcoin#15039: Avoid leaking nLockTime fingerprint when anti-fee-sniping

This commit is contained in:
Kittywhiskers Van Gogh 2021-11-14 15:24:24 +05:30
parent 365e5c4205
commit a97eebd068
2 changed files with 2 additions and 1 deletions

View File

@ -3299,7 +3299,7 @@ static bool IsCurrentForAntiFeeSniping(interfaces::Chain::Lock& locked_chain)
if (::ChainstateActive().IsInitialBlockDownload()) { if (::ChainstateActive().IsInitialBlockDownload()) {
return false; return false;
} }
constexpr int64_t MAX_ANTI_FEE_SNIPING_TIP_AGE = 4 * 60; // in seconds constexpr int64_t MAX_ANTI_FEE_SNIPING_TIP_AGE = 8 * 60 * 60; // in seconds
if (::ChainActive().Tip()->GetBlockTime() < (GetTime() - MAX_ANTI_FEE_SNIPING_TIP_AGE)) { if (::ChainActive().Tip()->GetBlockTime() < (GetTime() - MAX_ANTI_FEE_SNIPING_TIP_AGE)) {
return false; return false;
} }

View File

@ -19,6 +19,7 @@ class CreateTxWalletTest(BitcoinTestFramework):
def run_test(self): def run_test(self):
self.log.info('Check that we have some (old) blocks and that anti-fee-sniping is disabled') self.log.info('Check that we have some (old) blocks and that anti-fee-sniping is disabled')
self.bump_mocktime(8 * 60 * 60 + 1)
assert_equal(self.nodes[0].getblockchaininfo()['blocks'], 200) assert_equal(self.nodes[0].getblockchaininfo()['blocks'], 200)
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1) txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
tx = self.nodes[0].decoderawtransaction(self.nodes[0].gettransaction(txid)['hex']) tx = self.nodes[0].decoderawtransaction(self.nodes[0].gettransaction(txid)['hex'])