mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-28 16:01:30 +00:00
Fix createrawtransaction and missing deserialize()
Found these issues while trying to create, sign, and broadcast a raw transaction. * createrawtransaction was using old signature for Transaction constructor * Signwithwallet and decoderawtransaction need to call deserialize on tx before they can access inputs and outputs. (Maybe adding getInputs() and getOutputs() which deserializes if needed might be nicer)
This commit is contained in:
parent
5fa2a48343
commit
0ec62c8f36
1 changed files with 3 additions and 1 deletions
|
@ -173,7 +173,7 @@ class Commands:
|
||||||
else:
|
else:
|
||||||
raise BaseException('Transaction output not in wallet', prevout_hash+":%d"%prevout_n)
|
raise BaseException('Transaction output not in wallet', prevout_hash+":%d"%prevout_n)
|
||||||
outputs = map(lambda x: ('address', x[0], int(1e8*x[1])), outputs.items())
|
outputs = map(lambda x: ('address', x[0], int(1e8*x[1])), outputs.items())
|
||||||
tx = Transaction(tx_inputs, outputs)
|
tx = Transaction.from_io(tx_inputs, outputs)
|
||||||
return tx
|
return tx
|
||||||
|
|
||||||
def signtxwithkey(self, raw_tx, sec):
|
def signtxwithkey(self, raw_tx, sec):
|
||||||
|
@ -184,11 +184,13 @@ class Commands:
|
||||||
|
|
||||||
def signtxwithwallet(self, raw_tx):
|
def signtxwithwallet(self, raw_tx):
|
||||||
tx = Transaction(raw_tx)
|
tx = Transaction(raw_tx)
|
||||||
|
tx.deserialize()
|
||||||
self.wallet.sign_transaction(tx, self.password)
|
self.wallet.sign_transaction(tx, self.password)
|
||||||
return tx
|
return tx
|
||||||
|
|
||||||
def decoderawtransaction(self, raw):
|
def decoderawtransaction(self, raw):
|
||||||
tx = Transaction(raw)
|
tx = Transaction(raw)
|
||||||
|
tx.deserialize()
|
||||||
return {'inputs':tx.inputs, 'outputs':tx.outputs}
|
return {'inputs':tx.inputs, 'outputs':tx.outputs}
|
||||||
|
|
||||||
def sendrawtransaction(self, raw):
|
def sendrawtransaction(self, raw):
|
||||||
|
|
Loading…
Add table
Reference in a new issue