Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d062792493 | ||
|
|
8b2b7cbfb0 | ||
|
|
2d8f43d50a |
@ -1,3 +1,7 @@
|
||||
# Release 2.8.3
|
||||
* Blockchain checkpoints can be added and configured from the GUI.
|
||||
* Fix crash on reading older wallet formats.
|
||||
|
||||
# Release 2.8.2
|
||||
* show paid invoices in history tab
|
||||
* improve CPFP dialog
|
||||
|
||||
@ -80,7 +80,27 @@ class WalletStorage(PrintError):
|
||||
try:
|
||||
self.data = json.loads(s)
|
||||
except:
|
||||
raise IOError("Cannot read wallet file '%s'" % self.path)
|
||||
try:
|
||||
d = ast.literal_eval(s)
|
||||
labels = d.get('labels', {})
|
||||
except Exception as e:
|
||||
raise IOError("Cannot read wallet file '%s'" % self.path)
|
||||
self.data = {}
|
||||
# In old versions of Electrum labels were latin1 encoded, this fixes breakage.
|
||||
for i, label in labels.items():
|
||||
try:
|
||||
unicode(label)
|
||||
except UnicodeDecodeError:
|
||||
d['labels'][i] = unicode(label.decode('latin1'))
|
||||
for key, value in d.items():
|
||||
try:
|
||||
json.dumps(key)
|
||||
json.dumps(value)
|
||||
except:
|
||||
self.print_error('Failed to convert label to json format', key)
|
||||
continue
|
||||
self.data[key] = value
|
||||
|
||||
# check here if I need to load a plugin
|
||||
t = self.get('wallet_type')
|
||||
l = plugin_loaders.get(t)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
ELECTRUM_VERSION = '2.8.2' # version of the client package
|
||||
ELECTRUM_VERSION = '2.8.3' # version of the client package
|
||||
PROTOCOL_VERSION = '0.10' # protocol version requested
|
||||
|
||||
# The hash of the mnemonic seed must begin with this
|
||||
|
||||
@ -142,7 +142,7 @@ class Plugin(TrustedCoinPlugin):
|
||||
vbox.addLayout(hbox)
|
||||
vbox.addStretch(10)
|
||||
|
||||
msg = _('TrustedCoin charges a fee per co-signed transaction. You may pay on each transaction (an extra output will be added to your transaction), or you may purchase prepaid transaction using this dialog.') + '<br/>'
|
||||
msg = _('TrustedCoin charges a small fee to co-sign transactions. The fee depends on how many prepaid transactions you buy. An extra output is added to your transaction everytime you run out of prepaid transactions.') + '<br/>'
|
||||
label = QLabel(msg)
|
||||
label.setWordWrap(1)
|
||||
vbox.addWidget(label)
|
||||
@ -152,35 +152,21 @@ class Plugin(TrustedCoinPlugin):
|
||||
vbox.addLayout(grid)
|
||||
|
||||
price_per_tx = wallet.price_per_tx
|
||||
v = price_per_tx.get(1)
|
||||
grid.addWidget(QLabel(_("Price per transaction (not prepaid):")), 0, 0)
|
||||
grid.addWidget(QLabel(window.format_amount(v) + ' ' + window.base_unit()), 0, 1)
|
||||
|
||||
i = 1
|
||||
|
||||
n_prepay = wallet.num_prepay(self.config)
|
||||
i = 0
|
||||
for k, v in sorted(price_per_tx.items()):
|
||||
if k == 1:
|
||||
continue
|
||||
grid.addWidget(QLabel("Price for %d prepaid transactions:"%k), i, 0)
|
||||
grid.addWidget(QLabel("%d x "%k + window.format_amount(v/k) + ' ' + window.base_unit()), i, 1)
|
||||
b = QPushButton(_("Buy"))
|
||||
b.clicked.connect(lambda b, k=k, v=v: self.on_buy(window, k, v, d))
|
||||
grid.addWidget(QLabel("Pay every %d transactions:"%k), i, 0)
|
||||
grid.addWidget(QLabel(window.format_amount(v/k) + ' ' + window.base_unit() + "/tx"), i, 1)
|
||||
b = QRadioButton()
|
||||
b.setChecked(k == n_prepay)
|
||||
b.clicked.connect(lambda b, k=k: self.config.set_key('trustedcoin_prepay', k, True))
|
||||
grid.addWidget(b, i, 2)
|
||||
i += 1
|
||||
|
||||
n = wallet.billing_info.get('tx_remaining', 0)
|
||||
grid.addWidget(QLabel(_("Your wallet has %d prepaid transactions.")%n), i, 0)
|
||||
|
||||
# tranfer button
|
||||
#def on_transfer():
|
||||
# server.transfer_credit(self.user_id, recipient, otp, signature_callback)
|
||||
# pass
|
||||
#b = QPushButton(_("Transfer"))
|
||||
#b.clicked.connect(on_transfer)
|
||||
#grid.addWidget(b, 1, 2)
|
||||
|
||||
#grid.addWidget(QLabel(_("Next Billing Address:")), i, 0)
|
||||
#grid.addWidget(QLabel(self.billing_info['billing_address']), i, 1)
|
||||
vbox.addLayout(Buttons(CloseButton(d)))
|
||||
d.exec_()
|
||||
|
||||
|
||||
@ -209,7 +209,7 @@ class Wallet_2fa(Multisig_Wallet):
|
||||
sendable = sum(map(lambda x:x['value'], inputs))
|
||||
for i in inputs:
|
||||
self.add_input_info(i)
|
||||
xf = self.extra_fee()
|
||||
xf = self.extra_fee(config)
|
||||
_type, addr = recipient
|
||||
if xf and sendable >= xf:
|
||||
billing_address = self.billing_info['billing_address']
|
||||
@ -224,22 +224,33 @@ class Wallet_2fa(Multisig_Wallet):
|
||||
amount = max(0, sendable - fee)
|
||||
return amount, fee
|
||||
|
||||
def extra_fee(self):
|
||||
def min_prepay(self):
|
||||
return min(self.price_per_tx.keys())
|
||||
|
||||
def num_prepay(self, config):
|
||||
default = self.min_prepay()
|
||||
n = config.get('trustedcoin_prepay', default)
|
||||
if n not in self.price_per_tx:
|
||||
n = default
|
||||
return n
|
||||
|
||||
def extra_fee(self, config):
|
||||
if self.can_sign_without_server():
|
||||
return 0
|
||||
if self.billing_info.get('tx_remaining'):
|
||||
return 0
|
||||
if self.is_billing:
|
||||
return 0
|
||||
price = int(self.price_per_tx.get(1))
|
||||
assert price <= 100000
|
||||
n = self.num_prepay(config)
|
||||
price = int(self.price_per_tx[n])
|
||||
assert price <= 100000 * n
|
||||
return price
|
||||
|
||||
def make_unsigned_transaction(self, coins, outputs, config,
|
||||
fixed_fee=None, change_addr=None):
|
||||
mk_tx = lambda o: Multisig_Wallet.make_unsigned_transaction(
|
||||
self, coins, o, config, fixed_fee, change_addr)
|
||||
fee = self.extra_fee()
|
||||
fee = self.extra_fee(config)
|
||||
if fee:
|
||||
address = self.billing_info['billing_address']
|
||||
fee_output = (TYPE_ADDRESS, address, fee)
|
||||
@ -329,6 +340,7 @@ class TrustedCoinPlugin(BasePlugin):
|
||||
assert billing_address == billing_info['billing_address']
|
||||
wallet.billing_info = billing_info
|
||||
wallet.price_per_tx = dict(billing_info['price_per_tx'])
|
||||
wallet.price_per_tx.pop(1)
|
||||
return True
|
||||
|
||||
def make_seed(self):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user