Merge pull request #3259 from SomberNight/remove_requires_fee
remove Transaction.requires_fee()
This commit is contained in:
commit
d0cb19a0b2
|
@ -1354,7 +1354,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
if use_rbf:
|
if use_rbf:
|
||||||
tx.set_rbf(True)
|
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"))
|
self.show_error(_("This transaction requires a higher fee, or it will not be propagated by the network"))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -941,29 +941,6 @@ class Transaction:
|
||||||
}
|
}
|
||||||
return out
|
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):
|
def tx_from_str(txt):
|
||||||
"json or raw hexadecimal"
|
"json or raw hexadecimal"
|
||||||
|
|
Loading…
Reference in New Issue