mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
txfilter: clean up prototypes.
Use const, add TAKES to declaration. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
c9e271df90
commit
e76f863329
@@ -84,7 +84,8 @@ void subd_shutdown(struct subd *subd UNNEEDED, unsigned int seconds UNNEEDED)
|
|||||||
void timer_expired(tal_t *ctx UNNEEDED, struct timer *timer UNNEEDED)
|
void timer_expired(tal_t *ctx UNNEEDED, struct timer *timer UNNEEDED)
|
||||||
{ fprintf(stderr, "timer_expired called!\n"); abort(); }
|
{ fprintf(stderr, "timer_expired called!\n"); abort(); }
|
||||||
/* Generated stub for txfilter_add_derkey */
|
/* Generated stub for txfilter_add_derkey */
|
||||||
void txfilter_add_derkey(struct txfilter *filter UNNEEDED, u8 derkey[PUBKEY_DER_LEN])
|
void txfilter_add_derkey(struct txfilter *filter UNNEEDED,
|
||||||
|
const u8 derkey[PUBKEY_DER_LEN])
|
||||||
{ fprintf(stderr, "txfilter_add_derkey called!\n"); abort(); }
|
{ fprintf(stderr, "txfilter_add_derkey called!\n"); abort(); }
|
||||||
/* Generated stub for txfilter_new */
|
/* Generated stub for txfilter_new */
|
||||||
struct txfilter *txfilter_new(const tal_t *ctx UNNEEDED)
|
struct txfilter *txfilter_new(const tal_t *ctx UNNEEDED)
|
||||||
|
|||||||
@@ -73,6 +73,12 @@ bool derive_basepoints(const struct privkey *seed UNNEEDED,
|
|||||||
/* Generated stub for extract_channel_id */
|
/* Generated stub for extract_channel_id */
|
||||||
bool extract_channel_id(const u8 *in_pkt UNNEEDED, struct channel_id *channel_id UNNEEDED)
|
bool extract_channel_id(const u8 *in_pkt UNNEEDED, struct channel_id *channel_id UNNEEDED)
|
||||||
{ fprintf(stderr, "extract_channel_id called!\n"); abort(); }
|
{ fprintf(stderr, "extract_channel_id called!\n"); abort(); }
|
||||||
|
/* Generated stub for fromwire_gossipctl_peer_disconnect_reply */
|
||||||
|
bool fromwire_gossipctl_peer_disconnect_reply(const void *p UNNEEDED)
|
||||||
|
{ fprintf(stderr, "fromwire_gossipctl_peer_disconnect_reply called!\n"); abort(); }
|
||||||
|
/* Generated stub for fromwire_gossipctl_peer_disconnect_replyfail */
|
||||||
|
bool fromwire_gossipctl_peer_disconnect_replyfail(const void *p UNNEEDED, bool *isconnected UNNEEDED)
|
||||||
|
{ fprintf(stderr, "fromwire_gossipctl_peer_disconnect_replyfail called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_gossip_getpeers_reply */
|
/* Generated stub for fromwire_gossip_getpeers_reply */
|
||||||
bool fromwire_gossip_getpeers_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct pubkey **id UNNEEDED, struct wireaddr **addr UNNEEDED, struct gossip_getnodes_entry ***nodes UNNEEDED)
|
bool fromwire_gossip_getpeers_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct pubkey **id UNNEEDED, struct wireaddr **addr UNNEEDED, struct gossip_getnodes_entry ***nodes UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_gossip_getpeers_reply called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_gossip_getpeers_reply called!\n"); abort(); }
|
||||||
@@ -191,6 +197,10 @@ void json_add_short_channel_id(struct json_result *response UNNEEDED,
|
|||||||
/* Generated stub for json_add_string */
|
/* Generated stub for json_add_string */
|
||||||
void json_add_string(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED, const char *value UNNEEDED)
|
void json_add_string(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED, const char *value UNNEEDED)
|
||||||
{ fprintf(stderr, "json_add_string called!\n"); abort(); }
|
{ fprintf(stderr, "json_add_string called!\n"); abort(); }
|
||||||
|
/* Generated stub for json_add_string_escape */
|
||||||
|
void json_add_string_escape(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||||
|
const char *value UNNEEDED)
|
||||||
|
{ fprintf(stderr, "json_add_string_escape called!\n"); abort(); }
|
||||||
/* Generated stub for json_add_txid */
|
/* Generated stub for json_add_txid */
|
||||||
void json_add_txid(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
void json_add_txid(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||||
const struct bitcoin_txid *txid UNNEEDED)
|
const struct bitcoin_txid *txid UNNEEDED)
|
||||||
@@ -338,6 +348,9 @@ u8 *towire_gossipctl_hand_back_peer(const tal_t *ctx UNNEEDED, const struct pubk
|
|||||||
/* Generated stub for towire_gossipctl_peer_addrhint */
|
/* Generated stub for towire_gossipctl_peer_addrhint */
|
||||||
u8 *towire_gossipctl_peer_addrhint(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
u8 *towire_gossipctl_peer_addrhint(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_gossipctl_peer_addrhint called!\n"); abort(); }
|
{ fprintf(stderr, "towire_gossipctl_peer_addrhint called!\n"); abort(); }
|
||||||
|
/* Generated stub for towire_gossipctl_peer_disconnect */
|
||||||
|
u8 *towire_gossipctl_peer_disconnect(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED)
|
||||||
|
{ fprintf(stderr, "towire_gossipctl_peer_disconnect called!\n"); abort(); }
|
||||||
/* Generated stub for towire_gossipctl_reach_peer */
|
/* Generated stub for towire_gossipctl_reach_peer */
|
||||||
u8 *towire_gossipctl_reach_peer(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED)
|
u8 *towire_gossipctl_reach_peer(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_gossipctl_reach_peer called!\n"); abort(); }
|
{ fprintf(stderr, "towire_gossipctl_reach_peer called!\n"); abort(); }
|
||||||
@@ -348,7 +361,7 @@ u8 *towire_gossip_disable_channel(const tal_t *ctx UNNEEDED, const struct short_
|
|||||||
u8 *towire_gossip_getpeers_request(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED)
|
u8 *towire_gossip_getpeers_request(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_gossip_getpeers_request called!\n"); abort(); }
|
{ fprintf(stderr, "towire_gossip_getpeers_request called!\n"); abort(); }
|
||||||
/* Generated stub for txfilter_add_scriptpubkey */
|
/* Generated stub for txfilter_add_scriptpubkey */
|
||||||
void txfilter_add_scriptpubkey(struct txfilter *filter UNNEEDED, u8 *script UNNEEDED)
|
void txfilter_add_scriptpubkey(struct txfilter *filter UNNEEDED, const u8 *script TAKES UNNEEDED)
|
||||||
{ fprintf(stderr, "txfilter_add_scriptpubkey called!\n"); abort(); }
|
{ fprintf(stderr, "txfilter_add_scriptpubkey called!\n"); abort(); }
|
||||||
/* Generated stub for unsupported_features */
|
/* Generated stub for unsupported_features */
|
||||||
bool unsupported_features(const u8 *gfeatures UNNEEDED, const u8 *lfeatures UNNEEDED)
|
bool unsupported_features(const u8 *gfeatures UNNEEDED, const u8 *lfeatures UNNEEDED)
|
||||||
@@ -373,18 +386,6 @@ struct txowatch *watch_txo(const tal_t *ctx UNNEEDED,
|
|||||||
size_t input_num UNNEEDED,
|
size_t input_num UNNEEDED,
|
||||||
const struct block *block))
|
const struct block *block))
|
||||||
{ fprintf(stderr, "watch_txo called!\n"); abort(); }
|
{ fprintf(stderr, "watch_txo called!\n"); abort(); }
|
||||||
/* Generated stub for json_add_string_escape */
|
|
||||||
void json_add_string_escape(struct json_result *result UNNEEDED, const char *fieldname UNNEEDED, const char *value UNNEEDED)
|
|
||||||
{ fprintf(stderr, "json_add_string_escape called!\n"); abort(); }
|
|
||||||
/* Generated stub for towire_gossipctl_peer_disconnect */
|
|
||||||
u8 *towire_gossipctl_peer_disconnect(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED)
|
|
||||||
{ fprintf(stderr, "towire_gossipctl_peer_disconnect called!\n"); abort(); }
|
|
||||||
/* Generated stub for fromwire_gossipctl_peer_disconnect_reply */
|
|
||||||
bool fromwire_gossipctl_peer_disconnect_reply(const void *p UNNEEDED)
|
|
||||||
{ fprintf(stderr, "fromwire_gossipctl_peer_disconnect_reply called!\n"); abort(); }
|
|
||||||
/* Generated stub for fromwire_gossipctl_peer_disconnect_replyfail*/
|
|
||||||
bool fromwire_gossipctl_peer_disconnect_replyfail(const void *p UNNEEDED, bool *isconnected UNNEEDED)
|
|
||||||
{ fprintf(stderr, "fromwire_gossipctl_peer_disconnect_replyfail called!\n"); abort(); }
|
|
||||||
/* AUTOGENERATED MOCKS END */
|
/* AUTOGENERATED MOCKS END */
|
||||||
|
|
||||||
#if DEVELOPER
|
#if DEVELOPER
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <wallet/wallet.h>
|
#include <wallet/wallet.h>
|
||||||
|
|
||||||
struct txfilter {
|
struct txfilter {
|
||||||
u8 **scriptpubkeys;
|
const u8 **scriptpubkeys;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct outpointfilter_entry {
|
struct outpointfilter_entry {
|
||||||
@@ -49,18 +49,19 @@ struct outpointfilter {
|
|||||||
struct txfilter *txfilter_new(const tal_t *ctx)
|
struct txfilter *txfilter_new(const tal_t *ctx)
|
||||||
{
|
{
|
||||||
struct txfilter *filter = tal(ctx, struct txfilter);
|
struct txfilter *filter = tal(ctx, struct txfilter);
|
||||||
filter->scriptpubkeys = tal_arr(filter, u8*, 0);
|
filter->scriptpubkeys = tal_arr(filter, const u8 *, 0);
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void txfilter_add_scriptpubkey(struct txfilter *filter, u8 *script)
|
void txfilter_add_scriptpubkey(struct txfilter *filter, const u8 *script TAKES)
|
||||||
{
|
{
|
||||||
size_t count = tal_count(filter->scriptpubkeys);
|
size_t count = tal_count(filter->scriptpubkeys);
|
||||||
tal_resize(&filter->scriptpubkeys, count + 1);
|
tal_resize(&filter->scriptpubkeys, count + 1);
|
||||||
filter->scriptpubkeys[count] = tal_dup_arr(filter, u8, script, tal_len(script), 0);
|
filter->scriptpubkeys[count] = tal_dup_arr(filter, u8, script, tal_len(script), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void txfilter_add_derkey(struct txfilter *filter, u8 derkey[PUBKEY_DER_LEN])
|
void txfilter_add_derkey(struct txfilter *filter,
|
||||||
|
const u8 derkey[PUBKEY_DER_LEN])
|
||||||
{
|
{
|
||||||
tal_t *tmpctx = tal_tmpctx(filter);
|
tal_t *tmpctx = tal_tmpctx(filter);
|
||||||
u8 *skp, *p2sh;
|
u8 *skp, *p2sh;
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ struct txfilter *txfilter_new(const tal_t *ctx);
|
|||||||
* scriptpubkey then the transaction is marked as a match. Adds
|
* scriptpubkey then the transaction is marked as a match. Adds
|
||||||
* scriptpubkey for both raw p2wpkh and p2wpkh wrapped in p2sh.
|
* scriptpubkey for both raw p2wpkh and p2wpkh wrapped in p2sh.
|
||||||
*/
|
*/
|
||||||
void txfilter_add_derkey(struct txfilter *filter, u8 derkey[PUBKEY_DER_LEN]);
|
void txfilter_add_derkey(struct txfilter *filter,
|
||||||
|
const u8 derkey[PUBKEY_DER_LEN]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* txfilter_match -- Check whether the tx matches the filter
|
* txfilter_match -- Check whether the tx matches the filter
|
||||||
@@ -36,7 +37,7 @@ bool txfilter_match(const struct txfilter *filter, const struct bitcoin_tx *tx);
|
|||||||
/**
|
/**
|
||||||
* txfilter_add_scriptpubkey -- Add a serialized scriptpubkey to the filter
|
* txfilter_add_scriptpubkey -- Add a serialized scriptpubkey to the filter
|
||||||
*/
|
*/
|
||||||
void txfilter_add_scriptpubkey(struct txfilter *filter, u8 *script);
|
void txfilter_add_scriptpubkey(struct txfilter *filter, const u8 *script TAKES);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* outpointfilter_new -- Create a new outpointfilter
|
* outpointfilter_new -- Create a new outpointfilter
|
||||||
|
|||||||
Reference in New Issue
Block a user