mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-14 14:39:50 +00:00
implement MIN_RELAY_TX_FEE
This commit is contained in:
parent
70e82e99ea
commit
fc7122008a
4 changed files with 17 additions and 5 deletions
|
@ -32,6 +32,7 @@ from PyQt4.QtCore import *
|
||||||
import PyQt4.QtCore as QtCore
|
import PyQt4.QtCore as QtCore
|
||||||
import PyQt4.QtGui as QtGui
|
import PyQt4.QtGui as QtGui
|
||||||
from electrum.interface import DEFAULT_SERVERS
|
from electrum.interface import DEFAULT_SERVERS
|
||||||
|
from electrum.bitcoin import MIN_RELAY_TX_FEE
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import icons_rc
|
import icons_rc
|
||||||
|
@ -795,8 +796,8 @@ class ElectrumWindow(QMainWindow):
|
||||||
self.show_message(str(e))
|
self.show_message(str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
if tx.requires_fee(self.wallet.verifier) and fee == 0:
|
if tx.requires_fee(self.wallet.verifier) and fee < MIN_RELAY_TX_FEE:
|
||||||
QMessageBox.warning(self, _('Error'), _("This transaction requires a fee, or it will not be propagated by the network."), _('OK'))
|
QMessageBox.warning(self, _('Error'), _("This transaction requires a higher fee, or it will not be propagated by the network."), _('OK'))
|
||||||
return
|
return
|
||||||
|
|
||||||
self.run_hook('send_tx', tx)
|
self.run_hook('send_tx', tx)
|
||||||
|
|
|
@ -35,6 +35,7 @@ MONOSPACE_FONT = 'Lucida Console' if platform.system() == 'Windows' else 'monosp
|
||||||
|
|
||||||
from electrum.util import format_satoshis
|
from electrum.util import format_satoshis
|
||||||
from electrum.interface import DEFAULT_SERVERS
|
from electrum.interface import DEFAULT_SERVERS
|
||||||
|
from electrum.bitcoin import MIN_RELAY_TX_FEE
|
||||||
|
|
||||||
def numbify(entry, is_int = False):
|
def numbify(entry, is_int = False):
|
||||||
text = entry.get_text().strip()
|
text = entry.get_text().strip()
|
||||||
|
@ -844,8 +845,8 @@ class ElectrumWindow:
|
||||||
self.show_message(str(e))
|
self.show_message(str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
if tx.requires_fee(self.wallet.verifier) and fee == 0:
|
if tx.requires_fee(self.wallet.verifier) and fee < MIN_RELAY_TX_FEE:
|
||||||
self.show_message( "This transaction requires a fee, or it will not be propagated by the network." )
|
self.show_message( "This transaction requires a higher fee, or it will not be propagated by the network." )
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -577,6 +577,7 @@ class BIP32Sequence:
|
||||||
|
|
||||||
################################## transactions
|
################################## transactions
|
||||||
|
|
||||||
|
MIN_RELAY_TX_FEE = 10000
|
||||||
|
|
||||||
class Transaction:
|
class Transaction:
|
||||||
|
|
||||||
|
@ -877,8 +878,16 @@ class Transaction:
|
||||||
|
|
||||||
|
|
||||||
def requires_fee(self, verifier):
|
def requires_fee(self, verifier):
|
||||||
|
# see https://en.bitcoin.it/wiki/Transaction_fees
|
||||||
threshold = 57600000
|
threshold = 57600000
|
||||||
size = len(self.raw)/2
|
size = len(self.raw)/2
|
||||||
|
if size >= 10000:
|
||||||
|
return True
|
||||||
|
|
||||||
|
for o in self.outputs:
|
||||||
|
value = o[1]
|
||||||
|
if value < 1000000:
|
||||||
|
return True
|
||||||
sum = 0
|
sum = 0
|
||||||
for i in self.inputs:
|
for i in self.inputs:
|
||||||
age = verifier.get_confirmations(i["tx_hash"])[0]
|
age = verifier.get_confirmations(i["tx_hash"])[0]
|
||||||
|
|
|
@ -912,6 +912,7 @@ class Wallet:
|
||||||
height = None
|
height = None
|
||||||
for h in ext_h:
|
for h in ext_h:
|
||||||
if h == ['*']: continue
|
if h == ['*']: continue
|
||||||
|
print_error(h)
|
||||||
for item in h:
|
for item in h:
|
||||||
if item.get('tx_hash') == tx_hash:
|
if item.get('tx_hash') == tx_hash:
|
||||||
height = item.get('height')
|
height = item.get('height')
|
||||||
|
|
Loading…
Add table
Reference in a new issue