mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-20 10:39:49 +01:00
044705a547
This bug is a classic case of being lazy: 1. peer_accept_channel() allocated its return off the input message, rather than taking an explicit allocation context. This concealed the lifetime nature of the return. 2. The context for sanitize_error was the error itself, rather than the more obvious tmpctx (connect_failed does not take). The global tmpctx removes the "efficiency" excuse for grabbing a random object to use as context, and is also nice and explicit. All-the-hard-work-by: @ZmnSCPxj
36 lines
1.0 KiB
C
36 lines
1.0 KiB
C
#ifndef LIGHTNING_LIGHTNINGD_OPENING_CONTROL_H
|
|
#define LIGHTNING_LIGHTNINGD_OPENING_CONTROL_H
|
|
#include "config.h"
|
|
#include <ccan/short_types/short_types.h>
|
|
|
|
struct channel_id;
|
|
struct crypto_state;
|
|
struct json_result;
|
|
struct lightningd;
|
|
struct pubkey;
|
|
struct uncommitted_channel;
|
|
struct wireaddr;
|
|
|
|
void json_add_uncommitted_channel(struct json_result *response,
|
|
const struct uncommitted_channel *uc);
|
|
|
|
/* Peer has spontaneously exited from gossip due to open msg. Return
|
|
* NULL if we took over, otherwise hand back to gossipd with this
|
|
* error (allocated off @ctx).
|
|
*/
|
|
u8 *peer_accept_channel(const tal_t *ctx,
|
|
struct lightningd *ld,
|
|
const struct pubkey *peer_id,
|
|
const struct wireaddr *addr,
|
|
const struct crypto_state *cs,
|
|
u64 gossip_index,
|
|
const u8 *gfeatures, const u8 *lfeatures,
|
|
int peer_fd, int gossip_fd,
|
|
const struct channel_id *channel_id,
|
|
const u8 *open_msg);
|
|
|
|
|
|
void kill_uncommitted_channel(struct uncommitted_channel *uc,
|
|
const char *why);
|
|
#endif /* LIGHTNING_LIGHTNINGD_OPENING_CONTROL_H */
|