add input_info when transaction is created
This commit is contained in:
@@ -391,7 +391,14 @@ class Transaction:
|
|||||||
self.outputs = outputs
|
self.outputs = outputs
|
||||||
extras = []
|
extras = []
|
||||||
for i in self.inputs:
|
for i in self.inputs:
|
||||||
e = { 'txid':i['tx_hash'], 'vout':i['index'], 'scriptPubKey':i.get('raw_output_script') }
|
|
||||||
|
e = { 'txid':i['tx_hash'],
|
||||||
|
'vout':i['index'],
|
||||||
|
'scriptPubKey':i.get('raw_output_script'),
|
||||||
|
'KeyID':i['KeyID'],
|
||||||
|
'redeemScript':i.get('redeemScript'),
|
||||||
|
'redeemPubkey':i.get('redeemPubkey')
|
||||||
|
}
|
||||||
extras.append(e)
|
extras.append(e)
|
||||||
# fixme: simplify this
|
# fixme: simplify this
|
||||||
i['prevout_hash'] = i['tx_hash']
|
i['prevout_hash'] = i['tx_hash']
|
||||||
|
|||||||
@@ -1181,6 +1181,7 @@ class Wallet:
|
|||||||
inputs, total, fee = self.choose_tx_inputs( amount, fee, domain )
|
inputs, total, fee = self.choose_tx_inputs( amount, fee, domain )
|
||||||
if not inputs:
|
if not inputs:
|
||||||
raise ValueError("Not enough funds")
|
raise ValueError("Not enough funds")
|
||||||
|
self.add_input_info(inputs)
|
||||||
outputs = self.add_tx_change(inputs, outputs, amount, fee, total, change_addr)
|
outputs = self.add_tx_change(inputs, outputs, amount, fee, total, change_addr)
|
||||||
return Transaction.from_io(inputs, outputs)
|
return Transaction.from_io(inputs, outputs)
|
||||||
|
|
||||||
@@ -1196,9 +1197,8 @@ class Wallet:
|
|||||||
return tx
|
return tx
|
||||||
|
|
||||||
|
|
||||||
def sign_transaction(self, tx, password):
|
def add_input_info(self, inputs):
|
||||||
keypairs = {}
|
for txin in inputs:
|
||||||
for i, txin in enumerate(tx.inputs):
|
|
||||||
address = txin['address']
|
address = txin['address']
|
||||||
account, sequence = self.get_address_index(address)
|
account, sequence = self.get_address_index(address)
|
||||||
txin['KeyID'] = self.get_keyID(account, sequence)
|
txin['KeyID'] = self.get_keyID(account, sequence)
|
||||||
@@ -1207,6 +1207,12 @@ class Wallet:
|
|||||||
txin['redeemScript'] = redeemScript
|
txin['redeemScript'] = redeemScript
|
||||||
else:
|
else:
|
||||||
txin['redeemPubkey'] = self.accounts[account].get_pubkey(*sequence)
|
txin['redeemPubkey'] = self.accounts[account].get_pubkey(*sequence)
|
||||||
|
|
||||||
|
|
||||||
|
def sign_transaction(self, tx, password):
|
||||||
|
keypairs = {}
|
||||||
|
for i, txin in enumerate(tx.inputs):
|
||||||
|
address = txin['address']
|
||||||
private_keys = self.get_private_key(address, password)
|
private_keys = self.get_private_key(address, password)
|
||||||
for sec in private_keys:
|
for sec in private_keys:
|
||||||
pubkey = public_key_from_private_key(sec)
|
pubkey = public_key_from_private_key(sec)
|
||||||
|
|||||||
Reference in New Issue
Block a user