mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-10 20:49:52 +00:00
fix #1728
This commit is contained in:
parent
753a28b452
commit
94dbfe6791
3 changed files with 8 additions and 5 deletions
|
@ -2244,9 +2244,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
|
|
||||||
|
|
||||||
def tx_from_text(self, txt):
|
def tx_from_text(self, txt):
|
||||||
from electrum.transaction import tx_from_str
|
from electrum.transaction import tx_from_str, Transaction
|
||||||
try:
|
try:
|
||||||
return tx_from_str(txt)
|
tx = tx_from_str(txt)
|
||||||
|
return Transaction(tx)
|
||||||
except:
|
except:
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
self.show_critical(_("Electrum was unable to parse your transaction"))
|
self.show_critical(_("Electrum was unable to parse your transaction"))
|
||||||
|
|
|
@ -216,6 +216,7 @@ class Commands:
|
||||||
@command('wp')
|
@command('wp')
|
||||||
def signtransaction(self, tx, privkey=None):
|
def signtransaction(self, tx, privkey=None):
|
||||||
"""Sign a transaction. The wallet keys will be used unless a private key is provided."""
|
"""Sign a transaction. The wallet keys will be used unless a private key is provided."""
|
||||||
|
tx = Transaction(tx)
|
||||||
if privkey:
|
if privkey:
|
||||||
pubkey = bitcoin.public_key_from_private_key(privkey)
|
pubkey = bitcoin.public_key_from_private_key(privkey)
|
||||||
h160 = bitcoin.hash_160(pubkey.decode('hex'))
|
h160 = bitcoin.hash_160(pubkey.decode('hex'))
|
||||||
|
@ -228,11 +229,13 @@ class Commands:
|
||||||
@command('')
|
@command('')
|
||||||
def deserialize(self, tx):
|
def deserialize(self, tx):
|
||||||
"""Deserialize a serialized transaction"""
|
"""Deserialize a serialized transaction"""
|
||||||
|
tx = Transaction(tx)
|
||||||
return tx.deserialize()
|
return tx.deserialize()
|
||||||
|
|
||||||
@command('n')
|
@command('n')
|
||||||
def broadcast(self, tx, timeout=30):
|
def broadcast(self, tx, timeout=30):
|
||||||
"""Broadcast a transaction to the network. """
|
"""Broadcast a transaction to the network. """
|
||||||
|
tx = Transaction(tx)
|
||||||
return self.network.broadcast(tx, timeout)
|
return self.network.broadcast(tx, timeout)
|
||||||
|
|
||||||
@command('')
|
@command('')
|
||||||
|
|
|
@ -872,8 +872,7 @@ def tx_from_str(txt):
|
||||||
except:
|
except:
|
||||||
is_hex = False
|
is_hex = False
|
||||||
if is_hex:
|
if is_hex:
|
||||||
return Transaction(txt)
|
return txt
|
||||||
tx_dict = json.loads(str(txt))
|
tx_dict = json.loads(str(txt))
|
||||||
assert "hex" in tx_dict.keys()
|
assert "hex" in tx_dict.keys()
|
||||||
tx = Transaction(tx_dict["hex"])
|
return tx_dict["hex"]
|
||||||
return tx
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue