1
0

connect fee edits together

This commit is contained in:
SomberNight
2017-12-18 22:26:29 +01:00
committed by ThomasV
parent 96c86dac27
commit 3ba864bbca
4 changed files with 130 additions and 45 deletions

View File

@@ -253,7 +253,11 @@ class SimpleConfig(PrintError):
return fee_rate
def estimate_fee(self, size):
return int(self.fee_per_kb() * size / 1000.)
return self.estimate_fee_for_feerate(self.fee_per_kb(), size)
@classmethod
def estimate_fee_for_feerate(cls, fee_per_kb, size):
return int(fee_per_kb * size / 1000.)
def update_fee_estimates(self, key, value):
self.fee_estimates[key] = value

View File

@@ -34,8 +34,12 @@ import time
import json
import copy
import errno
import traceback
from functools import partial
from collections import defaultdict
from numbers import Number
import sys
from .i18n import _
from .util import NotEnoughFunds, PrintError, UserCancelled, profiler, format_satoshis
@@ -903,8 +907,12 @@ class Abstract_Wallet(PrintError):
# Fee estimator
if fixed_fee is None:
fee_estimator = config.estimate_fee
else:
elif isinstance(fixed_fee, Number):
fee_estimator = lambda size: fixed_fee
elif callable(fixed_fee):
fee_estimator = fixed_fee
else:
raise BaseException('Invalid argument fixed_fee: %s' % fixed_fee)
if i_max is None:
# Let the coin chooser select the coins to spend