Browse Source

Merge #680: More verbose absurd fee exception message

0e5eb2f3b1 More verbose absurd fee exception message (Kristaps Kaupe)

Pull request description:

  Display both sat/vkB and sat/vB values as we already do in other places, otherwise units may cause confusion for new users, and output both absurd fee value as well as estimated fee rate. This may help in supporting other users via Telegram, IRC, etc.

Top commit has no ACKs.

Tree-SHA512: 4c4c67399f8c427bd7e9aef71fbe6b7f748855b1163f97daa665c689e39be3bf33202ec44a4e2678f81ebb5c17d8b1a47524d86ea68410c096c39e98b0fda028
master
Kristaps Kaupe 5 years ago
parent
commit
134b727bba
No known key found for this signature in database
GPG Key ID: D47B1B4232B55437
  1. 6
      jmclient/jmclient/wallet.py

6
jmclient/jmclient/wallet.py

@ -84,8 +84,10 @@ def estimate_tx_fee(ins, outs, txtype='p2pkh', extra_bytes=0):
absurd_fee = jm_single().config.getint("POLICY", "absurd_fee_per_kb")
if fee_per_kb > absurd_fee:
#This error is considered critical; for safety reasons, shut down.
raise ValueError("Estimated fee per kB greater than absurd value: " + \
str(absurd_fee) + ", quitting.")
raise ValueError("Estimated fee " +
btc.fee_per_kb_to_str(fee_per_kb) +
" greater than absurd value " +
btc.fee_per_kb_to_str(absurd_fee) + ", quitting.")
if txtype in ['p2pkh', 'p2shMofN']:
tx_estimated_bytes = btc.estimate_tx_size(ins, outs, txtype) + extra_bytes
return int((tx_estimated_bytes * fee_per_kb)/Decimal(1000.0))

Loading…
Cancel
Save