tx: Add chainparams to struct bitcoin_tx as context

The way we build transactions, serialize them, and compute fees depends on the
chain we are working on, so let's add some context to the transactions.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2019-07-30 16:14:43 +02:00
committed by Rusty Russell
parent 2537bd5afa
commit 9288a7906b
32 changed files with 244 additions and 138 deletions

View File

@@ -60,6 +60,7 @@ u8 *to_self_wscript(const tal_t *ctx,
}
struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
const struct chainparams *chainparams,
const struct bitcoin_txid *funding_txid,
unsigned int funding_txout,
struct amount_sat funding,
@@ -146,7 +147,7 @@ struct bitcoin_tx *initial_commit_tx(const tal_t *ctx,
/* Worst-case sizing: both to-local and to-remote outputs. */
tx = bitcoin_tx(ctx, 1, untrimmed + 2);
tx = bitcoin_tx(ctx, chainparams, 1, untrimmed + 2);
/* This could be done in a single loop, but we follow the BOLT
* literally to make comments in test vectors clearer. */