Browse Source

remove Transaction.requires_fee()

3.0.x
SomberNight 7 years ago
parent
commit
f8518c78d8
  1. 2
      gui/qt/main_window.py
  2. 23
      lib/transaction.py

2
gui/qt/main_window.py

@ -1354,7 +1354,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
if use_rbf:
tx.set_rbf(True)
if fee < self.wallet.relayfee() * tx.estimated_size() / 1000 and tx.requires_fee(self.wallet):
if fee < self.wallet.relayfee() * tx.estimated_size() / 1000:
self.show_error(_("This transaction requires a higher fee, or it will not be propagated by the network"))
return

23
lib/transaction.py

@ -941,29 +941,6 @@ class Transaction:
}
return out
def requires_fee(self, wallet):
# see https://en.bitcoin.it/wiki/Transaction_fees
#
# size must be smaller than 1 kbyte for free tx
size = len(self.serialize(-1))/2
if size >= 10000:
return True
# all outputs must be 0.01 BTC or larger for free tx
for addr, value in self.get_outputs():
if value < 1000000:
return True
# priority must be large enough for free tx
threshold = 57600000
weight = 0
for txin in self.inputs():
height, conf, timestamp = wallet.get_tx_height(txin["prevout_hash"])
weight += txin["value"] * conf
priority = weight / size
print_error(priority, threshold)
return priority < threshold
def tx_from_str(txt):
"json or raw hexadecimal"

Loading…
Cancel
Save