From 425a7af512eac9a1300564953599b303313cf5fa Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 29 Dec 2021 10:39:56 +1030 Subject: [PATCH] common/coin_mvt: clean up API a little. 1. tal_strndup(.., str, strlen(str)) == tal_strdup() 2. tal_strdup also takes(), so document that. 3. Avoid passing 'struct sha256' on the stack: use ptr. 4. Generally, structures shouldn't keep pointers to things they don't own. In this case, mvt->node_id. 5. Make payment_hash a pointer, since NULL is more natural than an all-zero hash. And add NON_NULL_ARGS() to the functions; it's cumbersome, but make it fairly clear what params are optional. Signed-off-by: Rusty Russell --- common/coin_mvt.c | 76 +++++++++++++-------------- common/coin_mvt.h | 52 +++++++++++------- lightningd/coin_mvts.c | 8 +-- lightningd/notification.c | 4 +- onchaind/test/run-grind_feerate-bug.c | 24 ++++++--- onchaind/test/run-grind_feerate.c | 24 ++++++--- wallet/test/run-wallet.c | 13 +++-- 7 files changed, 118 insertions(+), 83 deletions(-) diff --git a/common/coin_mvt.c b/common/coin_mvt.c index 6f981e7fe..68dd50e65 100644 --- a/common/coin_mvt.c +++ b/common/coin_mvt.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -54,19 +55,19 @@ enum mvt_tag *new_tag_arr(const tal_t *ctx, enum mvt_tag tag) struct channel_coin_mvt *new_channel_coin_mvt(const tal_t *ctx, const struct channel_id *cid, - struct sha256 payment_hash, - u64 *part_id, + const struct sha256 *payment_hash TAKES, + u64 *part_id TAKES, struct amount_msat amount, - enum mvt_tag *tags STEALS, + const enum mvt_tag *tags TAKES, bool is_credit, struct amount_msat fees) { struct channel_coin_mvt *mvt = tal(ctx, struct channel_coin_mvt); mvt->chan_id = *cid; - mvt->payment_hash = tal_dup(mvt, struct sha256, &payment_hash); - mvt->part_id = part_id; - mvt->tags = tal_steal(mvt, tags); + mvt->payment_hash = tal_dup_or_null(mvt, struct sha256, payment_hash); + mvt->part_id = tal_dup_or_null(mvt, u64, part_id); + mvt->tags = tal_dup_talarr(mvt, enum mvt_tag, tags); if (is_credit) { mvt->credit = amount; @@ -82,12 +83,12 @@ struct channel_coin_mvt *new_channel_coin_mvt(const tal_t *ctx, } static struct chain_coin_mvt *new_chain_coin_mvt(const tal_t *ctx, - const char *account_name, + const char *account_name TAKES, const struct bitcoin_txid *tx_txid, const struct bitcoin_outpoint *outpoint, const struct sha256 *payment_hash TAKES, u32 blockheight, - enum mvt_tag *tags STEALS, + enum mvt_tag *tags TAKES, struct amount_msat amount, bool is_credit, struct amount_sat output_val) @@ -95,8 +96,7 @@ static struct chain_coin_mvt *new_chain_coin_mvt(const tal_t *ctx, struct chain_coin_mvt *mvt = tal(ctx, struct chain_coin_mvt); if (account_name) - mvt->account_name = tal_strndup(mvt, account_name, - strlen(account_name)); + mvt->account_name = tal_strdup(mvt, account_name); else mvt->account_name = NULL; @@ -108,7 +108,7 @@ static struct chain_coin_mvt *new_chain_coin_mvt(const tal_t *ctx, mvt->payment_hash = tal_dup_or_null(mvt, struct sha256, payment_hash); mvt->blockheight = blockheight; - mvt->tags = tal_steal(mvt, tags); + mvt->tags = tal_dup_talarr(mvt, enum mvt_tag, tags); if (is_credit) { mvt->credit = amount; @@ -128,7 +128,7 @@ static struct chain_coin_mvt *new_chain_coin_mvt_sat(const tal_t *ctx, const struct bitcoin_outpoint *outpoint, const struct sha256 *payment_hash TAKES, u32 blockheight, - enum mvt_tag *tags, + enum mvt_tag *tags TAKES, struct amount_sat amt_sat, bool is_credit) { @@ -154,7 +154,8 @@ struct chain_coin_mvt *new_onchaind_withdraw(const tal_t *ctx, { return new_chain_coin_mvt_sat(ctx, NULL, spend_txid, outpoint, NULL, - blockheight, new_tag_arr(ctx, tag), + blockheight, + take(new_tag_arr(NULL, tag)), amount, false); } @@ -166,7 +167,8 @@ struct chain_coin_mvt *new_onchaind_deposit(const tal_t *ctx, { return new_chain_coin_mvt_sat(ctx, NULL, NULL, outpoint, NULL, - blockheight, new_tag_arr(ctx, tag), + blockheight, + take(new_tag_arr(NULL, tag)), amount, true); } @@ -179,7 +181,7 @@ struct chain_coin_mvt *new_coin_channel_close(const tal_t *ctx, { return new_chain_coin_mvt(ctx, NULL, txid, out, NULL, blockheight, - new_tag_arr(ctx, CHANNEL_CLOSE), + take(new_tag_arr(NULL, CHANNEL_CLOSE)), amount, false, output_val); } @@ -196,7 +198,7 @@ struct chain_coin_mvt *new_coin_channel_open(const tal_t *ctx, struct chain_coin_mvt *mvt; mvt = new_chain_coin_mvt(ctx, NULL, NULL, out, NULL, blockheight, - new_tag_arr(ctx, CHANNEL_OPEN), amount, + take(new_tag_arr(NULL, CHANNEL_OPEN)), amount, true, output_val); mvt->account_name = type_to_string(mvt, struct channel_id, chan_id); @@ -214,12 +216,12 @@ struct chain_coin_mvt *new_onchain_htlc_deposit(const tal_t *ctx, const struct bitcoin_outpoint *outpoint, u32 blockheight, struct amount_sat amount, - struct sha256 *payment_hash) + const struct sha256 *payment_hash) { return new_chain_coin_mvt_sat(ctx, NULL, NULL, outpoint, payment_hash, blockheight, - new_tag_arr(ctx, HTLC_FULFILL), + take(new_tag_arr(NULL, HTLC_FULFILL)), amount, true); } @@ -228,14 +230,14 @@ struct chain_coin_mvt *new_onchain_htlc_withdraw(const tal_t *ctx, const struct bitcoin_outpoint *outpoint, u32 blockheight, struct amount_sat amount, - struct sha256 *payment_hash) + const struct sha256 *payment_hash) { /* An onchain htlc fulfillment to peer is a *deposit* of * that output into their (external) account */ return new_chain_coin_mvt_sat(ctx, EXTERNAL, NULL, outpoint, payment_hash, blockheight, - new_tag_arr(ctx, HTLC_FULFILL), + take(new_tag_arr(NULL, HTLC_FULFILL)), amount, false); } @@ -248,7 +250,7 @@ struct chain_coin_mvt *new_coin_external_spend(const tal_t *ctx, { return new_chain_coin_mvt(ctx, EXTERNAL, txid, outpoint, NULL, blockheight, - new_tag_arr(ctx, tag), + take(new_tag_arr(NULL, tag)), AMOUNT_MSAT(0), true, amount); } @@ -261,7 +263,7 @@ struct chain_coin_mvt *new_coin_external_deposit(const tal_t *ctx, return new_chain_coin_mvt(ctx, EXTERNAL, NULL, outpoint, NULL, blockheight, - new_tag_arr(ctx, tag), + take(new_tag_arr(NULL, tag)), AMOUNT_MSAT(0), true, amount); } @@ -273,7 +275,7 @@ struct chain_coin_mvt *new_coin_wallet_deposit(const tal_t *ctx, { return new_chain_coin_mvt_sat(ctx, WALLET, NULL, outpoint, NULL, - blockheight, new_tag_arr(ctx, tag), + blockheight, take(new_tag_arr(NULL, tag)), amount, true); } @@ -286,7 +288,7 @@ struct chain_coin_mvt *new_coin_wallet_withdraw(const tal_t *ctx, { return new_chain_coin_mvt_sat(ctx, WALLET, spend_txid, outpoint, NULL, - blockheight, new_tag_arr(ctx, tag), + blockheight, take(new_tag_arr(NULL, tag)), amount, false); } @@ -300,7 +302,7 @@ struct chain_coin_mvt *new_coin_penalty_sat(const tal_t *ctx, return new_chain_coin_mvt_sat(ctx, account_name, txid, outpoint, NULL, blockheight, - new_tag_arr(ctx, PENALTY), + take(new_tag_arr(NULL, PENALTY)), amount, false); } @@ -310,27 +312,22 @@ struct channel_coin_mvt *new_coin_channel_push(const tal_t *ctx, enum mvt_tag tag, bool is_credit) { - struct sha256 empty_hash; - /* Use a 0'd out payment hash */ - memset(&empty_hash, 0, sizeof(empty_hash)); - - return new_channel_coin_mvt(ctx, cid, empty_hash, + return new_channel_coin_mvt(ctx, cid, NULL, NULL, amount, - new_tag_arr(ctx, tag), is_credit, + take(new_tag_arr(NULL, tag)), is_credit, AMOUNT_MSAT(0)); } struct coin_mvt *finalize_chain_mvt(const tal_t *ctx, const struct chain_coin_mvt *chain_mvt, - const char *bip173_name, + const char *bip173_name TAKES, u32 timestamp, struct node_id *node_id) { struct coin_mvt *mvt = tal(ctx, struct coin_mvt); - mvt->account_id = tal_strndup(mvt, chain_mvt->account_name, - strlen(chain_mvt->account_name)); - mvt->bip173_name = tal_strndup(mvt, bip173_name, strlen(bip173_name)); + mvt->account_id = tal_strdup(mvt, chain_mvt->account_name); + mvt->bip173_name = tal_strdup(mvt, bip173_name); mvt->type = CHAIN_MVT; mvt->id.tx_txid = chain_mvt->tx_txid; @@ -354,14 +351,15 @@ struct coin_mvt *finalize_chain_mvt(const tal_t *ctx, struct coin_mvt *finalize_channel_mvt(const tal_t *ctx, const struct channel_coin_mvt *chan_mvt, - const char *bip173_name, - u32 timestamp, struct node_id *node_id) + const char *bip173_name TAKES, + u32 timestamp, + const struct node_id *node_id TAKES) { struct coin_mvt *mvt = tal(ctx, struct coin_mvt); mvt->account_id = type_to_string(mvt, struct channel_id, &chan_mvt->chan_id); - mvt->bip173_name = tal_strndup(mvt, bip173_name, strlen(bip173_name)); + mvt->bip173_name = tal_strdup(mvt, bip173_name); mvt->type = CHANNEL_MVT; mvt->id.payment_hash = chan_mvt->payment_hash; mvt->id.part_id = chan_mvt->part_id; @@ -377,7 +375,7 @@ struct coin_mvt *finalize_channel_mvt(const tal_t *ctx, /* channel movements don't have a blockheight */ mvt->blockheight = 0; mvt->version = COIN_MVT_VERSION; - mvt->node_id = node_id; + mvt->node_id = tal_dup(mvt, struct node_id, node_id); return mvt; } diff --git a/common/coin_mvt.h b/common/coin_mvt.h index 84fedaff1..75459f773 100644 --- a/common/coin_mvt.h +++ b/common/coin_mvt.h @@ -133,32 +133,36 @@ enum mvt_tag *new_tag_arr(const tal_t *ctx, enum mvt_tag tag); struct channel_coin_mvt *new_channel_coin_mvt(const tal_t *ctx, const struct channel_id *cid, - struct sha256 payment_hash, - u64 *part_id, + const struct sha256 *payment_hash TAKES, + u64 *part_id TAKES, struct amount_msat amount, - enum mvt_tag *tags STEALS, + const enum mvt_tag *tags TAKES, bool is_credit, - struct amount_msat fees); + struct amount_msat fees) + NON_NULL_ARGS(2); struct chain_coin_mvt *new_onchaind_withdraw(const tal_t *ctx, const struct bitcoin_outpoint *outpoint, const struct bitcoin_txid *spend_txid, u32 blockheight, struct amount_sat amount, - enum mvt_tag tag); + enum mvt_tag tag) + NON_NULL_ARGS(2, 3); struct chain_coin_mvt *new_onchaind_deposit(const tal_t *ctx, const struct bitcoin_outpoint *outpoint, u32 blockheight, struct amount_sat amount, - enum mvt_tag tag); + enum mvt_tag tag) + NON_NULL_ARGS(2); struct chain_coin_mvt *new_coin_channel_close(const tal_t *ctx, const struct bitcoin_txid *txid, const struct bitcoin_outpoint *out, u32 blockheight, const struct amount_msat amount, - const struct amount_sat output_val); + const struct amount_sat output_val) + NON_NULL_ARGS(2, 3); struct chain_coin_mvt *new_coin_channel_open(const tal_t *ctx, const struct channel_id *chan_id, @@ -167,69 +171,81 @@ struct chain_coin_mvt *new_coin_channel_open(const tal_t *ctx, const struct amount_msat amount, const struct amount_sat output_val, bool is_opener, - bool is_leased); + bool is_leased) + NON_NULL_ARGS(2, 3); struct chain_coin_mvt *new_onchain_htlc_deposit(const tal_t *ctx, const struct bitcoin_outpoint *outpoint, u32 blockheight, struct amount_sat amount, - struct sha256 *payment_hash); + const struct sha256 *payment_hash) + NON_NULL_ARGS(2, 5); struct chain_coin_mvt *new_onchain_htlc_withdraw(const tal_t *ctx, const struct bitcoin_outpoint *outpoint, u32 blockheight, struct amount_sat amount, - struct sha256 *payment_hash); + const struct sha256 *payment_hash) + NON_NULL_ARGS(2, 5); struct chain_coin_mvt *new_coin_wallet_deposit(const tal_t *ctx, const struct bitcoin_outpoint *outpoint, u32 blockheight, struct amount_sat amount, - enum mvt_tag tag); + enum mvt_tag tag) + NON_NULL_ARGS(2); struct chain_coin_mvt *new_coin_wallet_withdraw(const tal_t *ctx, const struct bitcoin_txid *spend_txid, const struct bitcoin_outpoint *outpoint, u32 blockheight, struct amount_sat amount, - enum mvt_tag tag); + enum mvt_tag tag) + NON_NULL_ARGS(2, 3); struct chain_coin_mvt *new_coin_external_spend(const tal_t *ctx, const struct bitcoin_outpoint *outpoint, const struct bitcoin_txid *txid, u32 blockheight, struct amount_sat amount, - enum mvt_tag tag); + enum mvt_tag tag) + NON_NULL_ARGS(2, 3); struct chain_coin_mvt *new_coin_external_deposit(const tal_t *ctx, const struct bitcoin_outpoint *outpoint, u32 blockheight, struct amount_sat amount, - enum mvt_tag tag); + enum mvt_tag tag) + NON_NULL_ARGS(2); struct chain_coin_mvt *new_coin_penalty_sat(const tal_t *ctx, const char *account_name, const struct bitcoin_txid *txid, const struct bitcoin_outpoint *outpoint, u32 blockheight, - struct amount_sat amount); + struct amount_sat amount) + NON_NULL_ARGS(3, 4); struct channel_coin_mvt *new_coin_channel_push(const tal_t *ctx, const struct channel_id *cid, struct amount_msat amount, enum mvt_tag tag, - bool is_credit); + bool is_credit) + NON_NULL_ARGS(2); struct coin_mvt *finalize_chain_mvt(const tal_t *ctx, const struct chain_coin_mvt *chain_mvt, const char *bip173_name, u32 timestamp, - struct node_id *node_id); + struct node_id *node_id) + NON_NULL_ARGS(2, 3); struct coin_mvt *finalize_channel_mvt(const tal_t *ctx, const struct channel_coin_mvt *chan_mvt, const char *bip173_name, - u32 timestamp, struct node_id *node_id); + u32 timestamp, + const struct node_id *node_id) + NON_NULL_ARGS(2, 3, 5); const char *mvt_type_str(enum mvt_type type); const char *mvt_tag_str(enum mvt_tag tag); diff --git a/lightningd/coin_mvts.c b/lightningd/coin_mvts.c index a77de4366..098d2ee82 100644 --- a/lightningd/coin_mvts.c +++ b/lightningd/coin_mvts.c @@ -36,7 +36,7 @@ struct channel_coin_mvt *new_channel_mvt_invoice_hin(const tal_t *ctx, struct channel *channel) { return new_channel_coin_mvt(ctx, &channel->cid, - hin->payment_hash, NULL, + &hin->payment_hash, NULL, hin->msat, new_tag_arr(ctx, INVOICE), true, AMOUNT_MSAT(0)); } @@ -55,7 +55,7 @@ struct channel_coin_mvt *new_channel_mvt_routed_hin(const tal_t *ctx, return NULL; return new_channel_coin_mvt(ctx, &channel->cid, - hin->payment_hash, NULL, + &hin->payment_hash, NULL, hin->msat, new_tag_arr(ctx, ROUTED), true, fees_collected); } @@ -65,7 +65,7 @@ struct channel_coin_mvt *new_channel_mvt_invoice_hout(const tal_t *ctx, struct channel *channel) { return new_channel_coin_mvt(ctx, &channel->cid, - hout->payment_hash, &hout->partid, + &hout->payment_hash, &hout->partid, hout->msat, new_tag_arr(ctx, INVOICE), false, hout->fees); } @@ -75,7 +75,7 @@ struct channel_coin_mvt *new_channel_mvt_routed_hout(const tal_t *ctx, struct channel *channel) { return new_channel_coin_mvt(ctx, &channel->cid, - hout->payment_hash, NULL, + &hout->payment_hash, NULL, hout->msat, new_tag_arr(ctx, ROUTED), false, hout->fees); diff --git a/lightningd/notification.c b/lightningd/notification.c index 8161aa83f..1b85e3ed4 100644 --- a/lightningd/notification.c +++ b/lightningd/notification.c @@ -452,7 +452,9 @@ static void json_mvt_id(struct json_stream *stream, enum mvt_type mvt_type, json_add_sha256(stream, "payment_hash", id->payment_hash); return; case CHANNEL_MVT: - json_add_sha256(stream, "payment_hash", id->payment_hash); + /* push funding / leases don't have a payment_hash */ + if (id->payment_hash) + json_add_sha256(stream, "payment_hash", id->payment_hash); if (id->part_id) json_add_u64(stream, "part_id", *id->part_id); return; diff --git a/onchaind/test/run-grind_feerate-bug.c b/onchaind/test/run-grind_feerate-bug.c index 76ae0744d..e14a2202b 100644 --- a/onchaind/test/run-grind_feerate-bug.c +++ b/onchaind/test/run-grind_feerate-bug.c @@ -119,14 +119,16 @@ struct chain_coin_mvt *new_coin_channel_close(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *out UNNEEDED, u32 blockheight UNNEEDED, const struct amount_msat amount UNNEEDED, - const struct amount_sat output_val UNNEEDED) + const struct amount_sat output_val) + { fprintf(stderr, "new_coin_channel_close called!\n"); abort(); } /* Generated stub for new_coin_external_deposit */ struct chain_coin_mvt *new_coin_external_deposit(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - enum mvt_tag tag UNNEEDED) + enum mvt_tag tag) + { fprintf(stderr, "new_coin_external_deposit called!\n"); abort(); } /* Generated stub for new_coin_external_spend */ struct chain_coin_mvt *new_coin_external_spend(const tal_t *ctx UNNEEDED, @@ -134,35 +136,40 @@ struct chain_coin_mvt *new_coin_external_spend(const tal_t *ctx UNNEEDED, const struct bitcoin_txid *txid UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - enum mvt_tag tag UNNEEDED) + enum mvt_tag tag) + { fprintf(stderr, "new_coin_external_spend called!\n"); abort(); } /* Generated stub for new_coin_wallet_deposit */ struct chain_coin_mvt *new_coin_wallet_deposit(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - enum mvt_tag tag UNNEEDED) + enum mvt_tag tag) + { fprintf(stderr, "new_coin_wallet_deposit called!\n"); abort(); } /* Generated stub for new_onchain_htlc_deposit */ struct chain_coin_mvt *new_onchain_htlc_deposit(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - struct sha256 *payment_hash UNNEEDED) + const struct sha256 *payment_hash) + { fprintf(stderr, "new_onchain_htlc_deposit called!\n"); abort(); } /* Generated stub for new_onchain_htlc_withdraw */ struct chain_coin_mvt *new_onchain_htlc_withdraw(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - struct sha256 *payment_hash UNNEEDED) + const struct sha256 *payment_hash) + { fprintf(stderr, "new_onchain_htlc_withdraw called!\n"); abort(); } /* Generated stub for new_onchaind_deposit */ struct chain_coin_mvt *new_onchaind_deposit(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - enum mvt_tag tag UNNEEDED) + enum mvt_tag tag) + { fprintf(stderr, "new_onchaind_deposit called!\n"); abort(); } /* Generated stub for new_onchaind_withdraw */ struct chain_coin_mvt *new_onchaind_withdraw(const tal_t *ctx UNNEEDED, @@ -170,7 +177,8 @@ struct chain_coin_mvt *new_onchaind_withdraw(const tal_t *ctx UNNEEDED, const struct bitcoin_txid *spend_txid UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - enum mvt_tag tag UNNEEDED) + enum mvt_tag tag) + { fprintf(stderr, "new_onchaind_withdraw called!\n"); abort(); } /* Generated stub for notleak_ */ void *notleak_(void *ptr UNNEEDED, bool plus_children UNNEEDED) diff --git a/onchaind/test/run-grind_feerate.c b/onchaind/test/run-grind_feerate.c index d25893b3d..23454c0aa 100644 --- a/onchaind/test/run-grind_feerate.c +++ b/onchaind/test/run-grind_feerate.c @@ -142,14 +142,16 @@ struct chain_coin_mvt *new_coin_channel_close(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *out UNNEEDED, u32 blockheight UNNEEDED, const struct amount_msat amount UNNEEDED, - const struct amount_sat output_val UNNEEDED) + const struct amount_sat output_val) + { fprintf(stderr, "new_coin_channel_close called!\n"); abort(); } /* Generated stub for new_coin_external_deposit */ struct chain_coin_mvt *new_coin_external_deposit(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - enum mvt_tag tag UNNEEDED) + enum mvt_tag tag) + { fprintf(stderr, "new_coin_external_deposit called!\n"); abort(); } /* Generated stub for new_coin_external_spend */ struct chain_coin_mvt *new_coin_external_spend(const tal_t *ctx UNNEEDED, @@ -157,35 +159,40 @@ struct chain_coin_mvt *new_coin_external_spend(const tal_t *ctx UNNEEDED, const struct bitcoin_txid *txid UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - enum mvt_tag tag UNNEEDED) + enum mvt_tag tag) + { fprintf(stderr, "new_coin_external_spend called!\n"); abort(); } /* Generated stub for new_coin_wallet_deposit */ struct chain_coin_mvt *new_coin_wallet_deposit(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - enum mvt_tag tag UNNEEDED) + enum mvt_tag tag) + { fprintf(stderr, "new_coin_wallet_deposit called!\n"); abort(); } /* Generated stub for new_onchain_htlc_deposit */ struct chain_coin_mvt *new_onchain_htlc_deposit(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - struct sha256 *payment_hash UNNEEDED) + const struct sha256 *payment_hash) + { fprintf(stderr, "new_onchain_htlc_deposit called!\n"); abort(); } /* Generated stub for new_onchain_htlc_withdraw */ struct chain_coin_mvt *new_onchain_htlc_withdraw(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - struct sha256 *payment_hash UNNEEDED) + const struct sha256 *payment_hash) + { fprintf(stderr, "new_onchain_htlc_withdraw called!\n"); abort(); } /* Generated stub for new_onchaind_deposit */ struct chain_coin_mvt *new_onchaind_deposit(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - enum mvt_tag tag UNNEEDED) + enum mvt_tag tag) + { fprintf(stderr, "new_onchaind_deposit called!\n"); abort(); } /* Generated stub for new_onchaind_withdraw */ struct chain_coin_mvt *new_onchaind_withdraw(const tal_t *ctx UNNEEDED, @@ -193,7 +200,8 @@ struct chain_coin_mvt *new_onchaind_withdraw(const tal_t *ctx UNNEEDED, const struct bitcoin_txid *spend_txid UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - enum mvt_tag tag UNNEEDED) + enum mvt_tag tag) + { fprintf(stderr, "new_onchaind_withdraw called!\n"); abort(); } /* Generated stub for notleak_ */ void *notleak_(void *ptr UNNEEDED, bool plus_children UNNEEDED) diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c index 52617a9e3..e452202ee 100644 --- a/wallet/test/run-wallet.c +++ b/wallet/test/run-wallet.c @@ -138,13 +138,12 @@ bool fromwire_custommsg_in(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 /* Generated stub for fromwire_gossipd_get_stripped_cupdate_reply */ bool fromwire_gossipd_get_stripped_cupdate_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **stripped_update UNNEEDED) { fprintf(stderr, "fromwire_gossipd_get_stripped_cupdate_reply called!\n"); abort(); } -u8 *towire_hsmd_new_channel(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED, u64 dbid UNNEEDED) -{ fprintf(stderr, "towire_hsmd_new_channel called!\n"); abort(); } -bool fromwire_hsmd_new_channel_reply(const void *p UNNEEDED) -{ fprintf(stderr, "fromwire_hsmd_new_channel_reply called!\n"); abort(); } /* Generated stub for fromwire_hsmd_get_output_scriptpubkey_reply */ bool fromwire_hsmd_get_output_scriptpubkey_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **script UNNEEDED) { fprintf(stderr, "fromwire_hsmd_get_output_scriptpubkey_reply called!\n"); abort(); } +/* Generated stub for fromwire_hsmd_new_channel_reply */ +bool fromwire_hsmd_new_channel_reply(const void *p UNNEEDED) +{ fprintf(stderr, "fromwire_hsmd_new_channel_reply called!\n"); abort(); } /* Generated stub for fromwire_hsmd_sign_commitment_tx_reply */ bool fromwire_hsmd_sign_commitment_tx_reply(const void *p UNNEEDED, struct bitcoin_signature *sig UNNEEDED) { fprintf(stderr, "fromwire_hsmd_sign_commitment_tx_reply called!\n"); abort(); } @@ -446,7 +445,8 @@ struct chain_coin_mvt *new_coin_wallet_deposit(const tal_t *ctx UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED, u32 blockheight UNNEEDED, struct amount_sat amount UNNEEDED, - enum mvt_tag tag UNNEEDED) + enum mvt_tag tag) + { fprintf(stderr, "new_coin_wallet_deposit called!\n"); abort(); } /* Generated stub for notify_chain_mvt */ void notify_chain_mvt(struct lightningd *ld UNNEEDED, const struct chain_coin_mvt *mvt UNNEEDED) @@ -750,6 +750,9 @@ u8 *towire_gossipd_get_stripped_cupdate(const tal_t *ctx UNNEEDED, const struct /* Generated stub for towire_hsmd_get_output_scriptpubkey */ u8 *towire_hsmd_get_output_scriptpubkey(const tal_t *ctx UNNEEDED, u64 channel_id UNNEEDED, const struct node_id *peer_id UNNEEDED, const struct pubkey *commitment_point UNNEEDED) { fprintf(stderr, "towire_hsmd_get_output_scriptpubkey called!\n"); abort(); } +/* Generated stub for towire_hsmd_new_channel */ +u8 *towire_hsmd_new_channel(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED, u64 dbid UNNEEDED) +{ fprintf(stderr, "towire_hsmd_new_channel called!\n"); abort(); } /* Generated stub for towire_hsmd_sign_commitment_tx */ u8 *towire_hsmd_sign_commitment_tx(const tal_t *ctx UNNEEDED, const struct node_id *peer_id UNNEEDED, u64 channel_dbid UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const struct pubkey *remote_funding_key UNNEEDED) { fprintf(stderr, "towire_hsmd_sign_commitment_tx called!\n"); abort(); }