Browse Source

wally: Build wally transactions in parallel with the old ones

Signed-off-by: Christian Decker <decker.christian@gmail.com>
pr-2587
Christian Decker 6 years ago
committed by Rusty Russell
parent
commit
bd2573eafb
  1. 11
      bitcoin/signature.c

11
bitcoin/signature.c

@ -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…
Cancel
Save