mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
wally: Build wally transactions in parallel with the old ones
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
b0c31a14c1
commit
bd2573eafb
1 changed files with 10 additions and 1 deletions
|
@ -109,12 +109,21 @@ void sign_tx_input(const struct bitcoin_tx *tx,
|
|||
enum sighash_type sighash_type,
|
||||
struct bitcoin_signature *sig)
|
||||
{
|
||||
struct sha256_double hash;
|
||||
struct sha256_double hash, whash;
|
||||
int flags = witness_script != NULL ? WALLY_TX_FLAG_USE_WITNESS : 0;
|
||||
const u8 *script = witness_script ? witness_script : subscript;
|
||||
|
||||
assert(sighash_type_valid(sighash_type));
|
||||
sig->sighash_type = sighash_type;
|
||||
wally_tx_get_btc_signature_hash(
|
||||
tx->wtx, in, script, tal_bytelen(script),
|
||||
tx->input[in].amount->satoshis /* Raw: low-level helper */,
|
||||
sighash_type, flags, whash.sha.u.u8, sizeof(whash));
|
||||
sha256_tx_one_input(tx, in, subscript, witness_script,
|
||||
sighash_type, &hash);
|
||||
|
||||
assert(memeq(&hash, sizeof(hash), &whash, sizeof(whash)));
|
||||
|
||||
dump_tx("Signing", tx, in, subscript, key, &hash);
|
||||
sign_hash(privkey, &hash, &sig->s);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue