wally: Migrate main daemon to use wally transactions

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2019-03-25 11:35:56 +01:00
committed by Rusty Russell
parent c39963b8b7
commit d651ce6f3b
13 changed files with 73 additions and 69 deletions

View File

@@ -104,7 +104,7 @@ void htlc_success_tx_add_witness(struct bitcoin_tx *htlc_success,
localhtlckey, remotehtlckey,
&hash, revocationkey);
witness = bitcoin_witness_htlc_success_tx(htlc_success->input,
witness = bitcoin_witness_htlc_success_tx(htlc_success,
localhtlcsig, remotehtlcsig,
payment_preimage, wscript);
bitcoin_tx_input_set_witness(htlc_success, 0, witness);
@@ -145,8 +145,8 @@ void htlc_timeout_tx_add_witness(struct bitcoin_tx *htlc_timeout,
localhtlckey, remotehtlckey,
payment_hash, revocationkey);
witness = bitcoin_witness_htlc_timeout_tx(
htlc_timeout->input, localhtlcsig, remotehtlcsig, wscript);
witness = bitcoin_witness_htlc_timeout_tx(htlc_timeout, localhtlcsig,
remotehtlcsig, wscript);
bitcoin_tx_input_set_witness(htlc_timeout, 0, witness);
tal_free(wscript);
}

View File

@@ -197,7 +197,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
n++;
}
assert(n <= tal_count(tx->output));
assert(n <= tx->wtx->num_outputs);
tal_resize(&tx->output, n);
/* BOLT #3:

View File

@@ -100,6 +100,7 @@ int main(void)
u8 *subscript, *script;
struct bitcoin_signature sig;
struct bitcoin_address addr;
struct amount_sat tmpamt;
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
| SECP256K1_CONTEXT_SIGN);
@@ -170,9 +171,11 @@ int main(void)
&inputkey, NULL);
printf("# fee: %s\n",
type_to_string(tmpctx, struct amount_sat, &fee));
tmpamt = bitcoin_tx_output_get_amount(funding, !funding_outnum);
printf("change: %s\n",
type_to_string(tmpctx, struct amount_sat,
&funding->output[!funding_outnum].amount));
&tmpamt));
printf("funding output: %u\n", funding_outnum);