fix sweeping
This commit is contained in:
@@ -2583,7 +2583,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
self.spend_max()
|
||||
self.payto_e.setFrozen(True)
|
||||
self.amount_e.setFrozen(True)
|
||||
except BaseException as e:
|
||||
except Exception as e: # FIXME too broad...
|
||||
self.show_message(str(e))
|
||||
return
|
||||
self.warn_if_watching_only()
|
||||
|
||||
@@ -2,6 +2,7 @@ from unittest import mock
|
||||
import shutil
|
||||
import tempfile
|
||||
from typing import Sequence
|
||||
import asyncio
|
||||
|
||||
from electrum import storage, bitcoin, keystore
|
||||
from electrum import Transaction
|
||||
@@ -997,7 +998,10 @@ class TestWalletSending(TestCaseForTestnet):
|
||||
class NetworkMock:
|
||||
relay_fee = 1000
|
||||
def get_local_height(self): return 1325785
|
||||
def listunspent_for_scripthash(self, scripthash):
|
||||
def run_from_another_thread(self, coro):
|
||||
loop = asyncio.get_event_loop()
|
||||
return loop.run_until_complete(coro)
|
||||
async def listunspent_for_scripthash(self, scripthash):
|
||||
if scripthash == '460e4fb540b657d775d84ff4955c9b13bd954c2adc26a6b998331343f85b6a45':
|
||||
return [{'tx_hash': 'ac24de8b58e826f60bd7b9ba31670bdfc3e8aedb2f28d0e91599d741569e3429', 'tx_pos': 1, 'height': 1325785, 'value': 1000000}]
|
||||
else:
|
||||
|
||||
@@ -87,7 +87,7 @@ def append_utxos_to_inputs(inputs, network, pubkey, txin_type, imax):
|
||||
scripthash = bitcoin.script_to_scripthash(script)
|
||||
address = '(pubkey)'
|
||||
|
||||
u = network.listunspent_for_scripthash(scripthash)
|
||||
u = network.run_from_another_thread(network.listunspent_for_scripthash(scripthash))
|
||||
for item in u:
|
||||
if len(inputs) >= imax:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user