define wallet.dummy_address method
This commit is contained in:
parent
57af8d1d39
commit
3ee61c4c6e
|
@ -275,8 +275,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
self.update_recently_visited(wallet.storage.path)
|
self.update_recently_visited(wallet.storage.path)
|
||||||
self.import_old_contacts()
|
self.import_old_contacts()
|
||||||
# address used to create a dummy transaction and estimate transaction fee
|
# address used to create a dummy transaction and estimate transaction fee
|
||||||
a = self.wallet.addresses(False)
|
|
||||||
self.dummy_address = a[0] if a else None
|
|
||||||
self.accounts_expanded = self.wallet.storage.get('accounts_expanded',{})
|
self.accounts_expanded = self.wallet.storage.get('accounts_expanded',{})
|
||||||
self.current_account = self.wallet.storage.get("current_account", None)
|
self.current_account = self.wallet.storage.get("current_account", None)
|
||||||
self.history_list.update()
|
self.history_list.update()
|
||||||
|
@ -1095,7 +1093,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
else:
|
else:
|
||||||
fee = self.fee_e.get_amount() if freeze_fee else None
|
fee = self.fee_e.get_amount() if freeze_fee else None
|
||||||
if not outputs:
|
if not outputs:
|
||||||
addr = self.payto_e.payto_address if self.payto_e.payto_address else self.dummy_address
|
addr = self.payto_e.payto_address if self.payto_e.payto_address else self.wallet.dummy_address()
|
||||||
outputs = [(TYPE_ADDRESS, addr, amount)]
|
outputs = [(TYPE_ADDRESS, addr, amount)]
|
||||||
try:
|
try:
|
||||||
tx = self.wallet.make_unsigned_transaction(self.get_coins(), outputs, self.config, fee)
|
tx = self.wallet.make_unsigned_transaction(self.get_coins(), outputs, self.config, fee)
|
||||||
|
|
|
@ -654,12 +654,14 @@ class Abstract_Wallet(PrintError):
|
||||||
continue
|
continue
|
||||||
return coins
|
return coins
|
||||||
|
|
||||||
|
def dummy_address(self):
|
||||||
|
return self.addresses(False)[0]
|
||||||
|
|
||||||
def get_max_amount(self, config, inputs, fee):
|
def get_max_amount(self, config, inputs, fee):
|
||||||
sendable = sum(map(lambda x:x['value'], inputs))
|
sendable = sum(map(lambda x:x['value'], inputs))
|
||||||
for i in inputs:
|
for i in inputs:
|
||||||
self.add_input_info(i)
|
self.add_input_info(i)
|
||||||
addr = self.addresses(False)[0]
|
output = (TYPE_ADDRESS, self.dummy_address(), sendable)
|
||||||
output = (TYPE_ADDRESS, addr, sendable)
|
|
||||||
dummy_tx = Transaction.from_io(inputs, [output])
|
dummy_tx = Transaction.from_io(inputs, [output])
|
||||||
if fee is None:
|
if fee is None:
|
||||||
fee = self.estimate_fee(config, dummy_tx.estimated_size())
|
fee = self.estimate_fee(config, dummy_tx.estimated_size())
|
||||||
|
|
|
@ -211,7 +211,7 @@ class Wallet_2fa(Multisig_Wallet):
|
||||||
sendable = sum(map(lambda x:x['value'], inputs))
|
sendable = sum(map(lambda x:x['value'], inputs))
|
||||||
for i in inputs:
|
for i in inputs:
|
||||||
self.add_input_info(i)
|
self.add_input_info(i)
|
||||||
dummy_address = self.addresses(False)[0]
|
dummy_address = self.dummy_address()
|
||||||
xf = self.extra_fee()
|
xf = self.extra_fee()
|
||||||
if xf and sendable >= xf:
|
if xf and sendable >= xf:
|
||||||
billing_address = self.billing_info['billing_address']
|
billing_address = self.billing_info['billing_address']
|
||||||
|
@ -219,7 +219,7 @@ class Wallet_2fa(Multisig_Wallet):
|
||||||
outputs = [(TYPE_ADDRESS, dummy_address, sendable),
|
outputs = [(TYPE_ADDRESS, dummy_address, sendable),
|
||||||
(TYPE_ADDRESS, billing_address, xf)]
|
(TYPE_ADDRESS, billing_address, xf)]
|
||||||
else:
|
else:
|
||||||
outputs = [(TYPE_ADDRESS, dummy_addr, sendable)]
|
outputs = [(TYPE_ADDRESS, dummy_address, sendable)]
|
||||||
|
|
||||||
dummy_tx = Transaction.from_io(inputs, outputs)
|
dummy_tx = Transaction.from_io(inputs, outputs)
|
||||||
if fee is None:
|
if fee is None:
|
||||||
|
|
Loading…
Reference in New Issue