Create a constant for 100000000 and use it
Use same name as is in bitcoind. Note that one of the constants in text.py had the wrong number of zeroes previously...
This commit is contained in:
14
gui/gtk.py
14
gui/gtk.py
@@ -25,7 +25,7 @@ gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk, Gdk, GObject, cairo
|
||||
from decimal import Decimal
|
||||
from electrum.util import print_error, InvalidPassword
|
||||
from electrum.bitcoin import is_valid
|
||||
from electrum.bitcoin import is_valid, COIN
|
||||
from electrum.wallet import NotEnoughFunds
|
||||
from electrum import WalletStorage, Wallet
|
||||
|
||||
@@ -48,7 +48,7 @@ def numbify(entry, is_int = False):
|
||||
s = s.replace('.','')
|
||||
s = s[:p] + '.' + s[p:p+8]
|
||||
try:
|
||||
amount = int( Decimal(s) * 100000000 )
|
||||
amount = int(Decimal(s) * COIN)
|
||||
except Exception:
|
||||
amount = None
|
||||
else:
|
||||
@@ -164,7 +164,7 @@ def run_settings_dialog(self):
|
||||
fee_label.set_size_request(150,10)
|
||||
fee_label.show()
|
||||
fee.pack_start(fee_label,False, False, 10)
|
||||
fee_entry.set_text( str( Decimal(self.wallet.fee_per_kb) /100000000 ) )
|
||||
fee_entry.set_text(str(Decimal(self.wallet.fee_per_kb) / COIN))
|
||||
fee_entry.connect('changed', numbify, False)
|
||||
fee_entry.show()
|
||||
fee.pack_start(fee_entry,False,False, 10)
|
||||
@@ -196,7 +196,7 @@ def run_settings_dialog(self):
|
||||
return
|
||||
|
||||
try:
|
||||
fee = int( 100000000 * Decimal(fee) )
|
||||
fee = int(COIN * Decimal(fee))
|
||||
except Exception:
|
||||
show_message("error")
|
||||
return
|
||||
@@ -698,7 +698,7 @@ class ElectrumWindow:
|
||||
if not self.funds_error:
|
||||
if not is_fee:
|
||||
fee = tx.get_fee()
|
||||
fee_entry.set_text( str( Decimal( fee ) / 100000000 ) )
|
||||
fee_entry.set_text(str(Decimal(fee) / COIN))
|
||||
self.fee_box.show()
|
||||
amount_entry.modify_text(Gtk.StateType.NORMAL, Gdk.color_parse("#000000"))
|
||||
fee_entry.modify_text(Gtk.StateType.NORMAL, Gdk.color_parse("#000000"))
|
||||
@@ -791,12 +791,12 @@ class ElectrumWindow:
|
||||
return
|
||||
|
||||
try:
|
||||
amount = int( Decimal(amount_entry.get_text()) * 100000000 )
|
||||
amount = int(Decimal(amount_entry.get_text()) * COIN)
|
||||
except Exception:
|
||||
self.show_message( "invalid amount")
|
||||
return
|
||||
try:
|
||||
fee = int( Decimal(fee_entry.get_text()) * 100000000 )
|
||||
fee = int(Decimal(fee_entry.get_text()) * COIN)
|
||||
except Exception:
|
||||
self.show_message( "invalid fee")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user