1
0

transaction.py: sign_txin. allow override for get_preimage_script.

test_commitment_tx_with_all_five_HTLCs_untrimmed_minimum_feerate now passes
This commit is contained in:
SomberNight
2018-04-23 13:52:20 +02:00
committed by ThomasV
parent 4d41299f1c
commit fd7469745e
2 changed files with 96 additions and 69 deletions

View File

@@ -358,27 +358,26 @@ def make_htlc_tx_witness(remotehtlcsig, localhtlcsig, payment_preimage, witness_
assert type(localhtlcsig) is bytes
assert type(payment_preimage) is bytes
assert type(witness_script) is bytes
return bfh(var_int(5) + '00' + ''.join([witness_push(x) for x in [bh2u(remotehtlcsig), bh2u(localhtlcsig), bh2u(payment_preimage), bh2u(witness_script)]]))
return bfh(var_int(5) + '00' + ''.join([witness_push(bh2u(x)) for x in [remotehtlcsig, localhtlcsig, payment_preimage, witness_script]]))
def make_htlc_tx_inputs(htlc_output_txid, htlc_output_index, revocationpubkey, local_delayedpubkey, amount_msat, witness, pubkeys, sigs):
def make_htlc_tx_inputs(htlc_output_txid, htlc_output_index, revocationpubkey, local_delayedpubkey, amount_msat, witness_script):
assert type(htlc_output_txid) is str
assert type(htlc_output_index) is int
assert type(revocationpubkey) is bytes
assert type(local_delayedpubkey) is bytes
assert type(amount_msat) is int
assert type(witness) is bytes
assert type(witness_script) is str
c_inputs = [{
'scriptSig': '',
'type': 'p2wsh',
'x_pubkeys': [bh2u(x) for x in pubkeys],
'signatures': sigs,
'num_sig': 2,
'signatures': [],
'num_sig': 0,
'prevout_n': htlc_output_index,
'prevout_hash': htlc_output_txid,
'value': amount_msat // 1000,
'coinbase': False,
'sequence': 0x0,
'witness': bh2u(witness)
'preimage_script': witness_script,
}]
return c_inputs