From dba4af37f19b458174169530cd972f0cb3c5eee6 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 21 Sep 2023 15:06:27 +0930 Subject: [PATCH] onchaind: remove #if DEVELOPER. Signed-off-by: Rusty Russell --- onchaind/onchaind.c | 7 ----- onchaind/test/run-grind_feerate-bug.c | 38 +++++++++++---------------- onchaind/test/run-grind_feerate.c | 23 +++++++--------- 3 files changed, 26 insertions(+), 42 deletions(-) diff --git a/onchaind/onchaind.c b/onchaind/onchaind.c index 729b23e69..da7ae3dbe 100644 --- a/onchaind/onchaind.c +++ b/onchaind/onchaind.c @@ -1581,7 +1581,6 @@ static void handle_preimage(struct tracked_output **outs, } } -#if DEVELOPER static void memleak_remove_globals(struct htable *memtable, const tal_t *topctx) { memleak_scan_obj(memtable, keyset); @@ -1612,12 +1611,6 @@ static void handle_dev_memleak(struct tracked_output ***outs, const u8 *msg) take(towire_onchaind_dev_memleak_reply(NULL, found_leak))); } -#else -static void handle_dev_memleak(struct tracked_output ***outs, const u8 *msg) -{ - master_badmsg(WIRE_ONCHAIND_DEV_MEMLEAK, msg); -} -#endif /* !DEVELOPER */ static void handle_onchaind_depth(struct tracked_output ***outs, const u8 *msg) { diff --git a/onchaind/test/run-grind_feerate-bug.c b/onchaind/test/run-grind_feerate-bug.c index a2214250f..8907b7dbe 100644 --- a/onchaind/test/run-grind_feerate-bug.c +++ b/onchaind/test/run-grind_feerate-bug.c @@ -30,6 +30,10 @@ bool derive_keyset(const struct pubkey *per_commitment_point UNNEEDED, bool option_static_remotekey UNNEEDED, struct keyset *keyset UNNEEDED) { fprintf(stderr, "derive_keyset called!\n"); abort(); } +/* Generated stub for dump_memleak */ +bool dump_memleak(struct htable *memtable UNNEEDED, + void (*print)(const char *fmt UNNEEDED, ...)) +{ fprintf(stderr, "dump_memleak called!\n"); abort(); } /* Generated stub for fromwire_basepoints */ void fromwire_basepoints(const u8 **ptr UNNEEDED, size_t *max UNNEEDED, struct basepoints *b UNNEEDED) @@ -87,6 +91,18 @@ struct bitcoin_tx *htlc_success_tx(const tal_t *ctx UNNEEDED, /* Generated stub for master_badmsg */ void master_badmsg(u32 type_expected UNNEEDED, const u8 *msg) { fprintf(stderr, "master_badmsg called!\n"); abort(); } +/* Generated stub for memleak_ptr */ +bool memleak_ptr(struct htable *memtable UNNEEDED, const void *p UNNEEDED) +{ fprintf(stderr, "memleak_ptr called!\n"); abort(); } +/* Generated stub for memleak_scan_obj */ +void memleak_scan_obj(struct htable *memtable UNNEEDED, const void *obj UNNEEDED) +{ fprintf(stderr, "memleak_scan_obj called!\n"); abort(); } +/* Generated stub for memleak_start */ +struct htable *memleak_start(const tal_t *ctx UNNEEDED) +{ fprintf(stderr, "memleak_start called!\n"); abort(); } +/* Generated stub for memleak_status_broken */ +void memleak_status_broken(const char *fmt UNNEEDED, ...) +{ fprintf(stderr, "memleak_status_broken called!\n"); abort(); } /* Generated stub for new_coin_channel_close */ struct chain_coin_mvt *new_coin_channel_close(const tal_t *ctx UNNEEDED, const struct bitcoin_txid *txid UNNEEDED, @@ -228,28 +244,6 @@ void towire_wallet_tx_type(u8 **pptr UNNEEDED, const enum wallet_tx_type type UN { fprintf(stderr, "towire_wallet_tx_type called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ -#if DEVELOPER -/* Generated stub for memleak_ptr */ -bool memleak_ptr(struct htable *memtable UNNEEDED, const void *p UNNEEDED) -{ fprintf(stderr, "memleak_ptr called!\n"); abort(); } -/* Generated stub for dump_memleak */ -bool dump_memleak(struct htable *memtable UNNEEDED, - void (*print)(const char *fmt UNNEEDED, ...)) -{ fprintf(stderr, "dump_memleak called!\n"); abort(); } -/* Generated stub for memleak_scan_obj */ -void memleak_scan_obj(struct htable *memtable UNNEEDED, const void *obj UNNEEDED) -{ fprintf(stderr, "memleak_scan_obj called!\n"); abort(); } -/* Generated stub for memleak_scan_region */ -void memleak_scan_region(struct htable *memtable UNNEEDED, const void *p UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "memleak_scan_region called!\n"); abort(); } -/* Generated stub for memleak_start */ -struct htable *memleak_start(const tal_t *ctx UNNEEDED) -{ fprintf(stderr, "memleak_start called!\n"); abort(); } -/* Generated stub for memleak_status_broken */ -void memleak_status_broken(const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "memleak_status_broken called!\n"); abort(); } -#endif /* DEVELOPER */ - /* Stubs which do get called. */ u8 *towire_hsmd_sign_local_htlc_tx(const tal_t *ctx UNNEEDED, u64 commit_num UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const u8 *wscript UNNEEDED, bool option_anchor_outputs UNNEEDED) { diff --git a/onchaind/test/run-grind_feerate.c b/onchaind/test/run-grind_feerate.c index 6dead6504..5cc527afa 100644 --- a/onchaind/test/run-grind_feerate.c +++ b/onchaind/test/run-grind_feerate.c @@ -29,6 +29,10 @@ bool derive_keyset(const struct pubkey *per_commitment_point UNNEEDED, bool option_static_remotekey UNNEEDED, struct keyset *keyset UNNEEDED) { fprintf(stderr, "derive_keyset called!\n"); abort(); } +/* Generated stub for dump_memleak */ +bool dump_memleak(struct htable *memtable UNNEEDED, + void (*print)(const char *fmt UNNEEDED, ...)) +{ fprintf(stderr, "dump_memleak called!\n"); abort(); } /* Generated stub for fromwire */ const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) { fprintf(stderr, "fromwire called!\n"); abort(); } @@ -134,12 +138,18 @@ struct bitcoin_tx *htlc_timeout_tx(const tal_t *ctx UNNEEDED, /* Generated stub for master_badmsg */ void master_badmsg(u32 type_expected UNNEEDED, const u8 *msg) { fprintf(stderr, "master_badmsg called!\n"); abort(); } +/* Generated stub for memleak_ptr */ +bool memleak_ptr(struct htable *memtable UNNEEDED, const void *p UNNEEDED) +{ fprintf(stderr, "memleak_ptr called!\n"); abort(); } /* Generated stub for memleak_scan_obj */ void memleak_scan_obj(struct htable *memtable UNNEEDED, const void *obj UNNEEDED) { fprintf(stderr, "memleak_scan_obj called!\n"); abort(); } /* Generated stub for memleak_start */ struct htable *memleak_start(const tal_t *ctx UNNEEDED) { fprintf(stderr, "memleak_start called!\n"); abort(); } +/* Generated stub for memleak_status_broken */ +void memleak_status_broken(const char *fmt UNNEEDED, ...) +{ fprintf(stderr, "memleak_status_broken called!\n"); abort(); } /* Generated stub for new_coin_channel_close */ struct chain_coin_mvt *new_coin_channel_close(const tal_t *ctx UNNEEDED, const struct bitcoin_txid *txid UNNEEDED, @@ -354,19 +364,6 @@ bool wire_sync_write(int fd UNNEEDED, const void *msg TAKES UNNEEDED) { fprintf(stderr, "wire_sync_write called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ -#if DEVELOPER -/* Generated stub for memleak_ptr */ -bool memleak_ptr(struct htable *memtable UNNEEDED, const void *p UNNEEDED) -{ fprintf(stderr, "memleak_ptr called!\n"); abort(); } -/* Generated stub for memleak_status_broken */ -void memleak_status_broken(const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "memleak_status_broken called!\n"); abort(); } -/* Generated stub for dump_memleak */ -bool dump_memleak(struct htable *memtable UNNEEDED, - void (*print)(const char *fmt UNNEEDED, ...)) -{ fprintf(stderr, "dump_memleak called!\n"); abort(); } -#endif - int main(int argc, char *argv[]) { common_setup(argv[0]);