From a07c0c983ad453151f630eb08c0037b0141c365c Mon Sep 17 00:00:00 2001 From: Alex Cato Date: Sun, 3 Sep 2017 22:51:38 +0200 Subject: [PATCH] Randomize manually set tx_fee to be within +/- 20% of the given value --- jmclient/jmclient/blockchaininterface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jmclient/jmclient/blockchaininterface.py b/jmclient/jmclient/blockchaininterface.py index 8c263bc..1e7e232 100644 --- a/jmclient/jmclient/blockchaininterface.py +++ b/jmclient/jmclient/blockchaininterface.py @@ -191,7 +191,7 @@ class ElectrumWalletInterface(BlockchainInterface): #pragma: no cover def estimate_fee_per_kb(self, N): if super(ElectrumWalletInterface, self).fee_per_kb_has_been_manually_set(N): - return N + return int(random.uniform(N * float(0.8), N * float(1.2))) fee = self.wallet.network.synchronous_get(('blockchain.estimatefee', [N] )) log.debug("Got fee: " + str(fee)) @@ -798,7 +798,7 @@ class BitcoinCoreInterface(BlockchainInterface): def estimate_fee_per_kb(self, N): if super(BitcoinCoreInterface, self).fee_per_kb_has_been_manually_set(N): - return N + return int(random.uniform(N * float(0.8), N * float(1.2))) estimate = int(Decimal(1e8) * Decimal(self.rpc('estimatefee', [N]))) if (N == 1) and (estimate < 0): # Special bitcoin core case: sometimes the highest priority