create_commit_tx: use HTLC map, not cstate HTLC array.

The HTLC state tells us whether a HTLC is in the commitment transaction.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-08-18 14:23:45 +09:30
parent 0af04b0576
commit d9e825bc2c
4 changed files with 78 additions and 130 deletions

View File

@@ -1,38 +1,25 @@
#ifndef LIGHTNING_COMMIT_TX_H
#define LIGHTNING_COMMIT_TX_H
#include "config.h"
#include "daemon/channel.h"
#include "daemon/htlc.h"
#include "htlc.h"
struct channel_state;
struct sha256_double;
struct sha256;
struct pubkey;
struct rel_locktime;
struct peer;
u8 *wscript_for_htlc(const tal_t *ctx,
secp256k1_context *secpctx,
const struct peer *peer,
const struct htlc *h,
const struct pubkey *our_final,
const struct pubkey *their_final,
const struct rel_locktime *our_locktime,
const struct rel_locktime *their_locktime,
const struct sha256 *rhash,
enum htlc_side side);
/* Create commitment tx to spend the anchor tx output; doesn't fill in
* input scriptsig. */
struct bitcoin_tx *create_commit_tx(const tal_t *ctx,
secp256k1_context *secpctx,
const struct pubkey *our_final,
const struct pubkey *their_final,
const struct rel_locktime *our_locktime,
const struct rel_locktime *their_locktime,
const struct sha256_double *anchor_txid,
unsigned int anchor_index,
u64 anchor_satoshis,
struct peer *peer,
const struct sha256 *rhash,
const struct channel_state *cstate,
enum channel_side side,
enum htlc_side side,
int **map);
#endif