mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
2c3543e42d
We were reaching through it to get `ld`, but channeld is already dead. Caught this on test_onchaind_replay (without valgrind) on my test machine: INFO 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#1: Peer transient failure in CHANNELD_NORMAL: channeld: Owning subdaemon channeld died (62208) **BROKEN** lightningd: FATAL SIGNAL 11 (version f6e1735) **BROKEN** lightningd: backtrace: common/daemon.c:44 (send_backtrace) 0x5634dc83dc55 **BROKEN** lightningd: backtrace: common/daemon.c:52 (crashdump) 0x5634dc83dca9 **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7fd4b7c0b46f **BROKEN** lightningd: backtrace: lightningd/peer_htlcs.c:285 (failmsg_incorrect_or_unknown) 0x5634dc82625a **BROKEN** lightningd: backtrace: lightningd/htlc_set.c:109 (htlc_set_add) 0x5634dc801e5c **BROKEN** lightningd: backtrace: lightningd/peer_htlcs.c:496 (handle_localpay) 0x5634dc826997 **BROKEN** lightningd: backtrace: lightningd/peer_htlcs.c:1008 (htlc_accepted_hook_callback) 0x5634dc827e60 **BROKEN** lightningd: backtrace: lightningd/plugin_hook.c:197 (plugin_hook_callback) 0x5634dc831ea1 **BROKEN** lightningd: backtrace: lightningd/plugin.c:261 (plugin_response_handle) 0x5634dc82d2c3 **BROKEN** lightningd: backtrace: lightningd/plugin.c:359 (plugin_read_json_one) 0x5634dc82d46f **BROKEN** lightningd: backtrace: lightningd/plugin.c:391 (plugin_read_json) 0x5634dc82d5c6 **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:59 (next_plan) 0x5634dc896319 **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:407 (do_plan) 0x5634dc896efe **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:417 (io_ready) 0x5634dc896f40 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
88 lines
3.1 KiB
C
88 lines
3.1 KiB
C
/* All about the HTLCs/commitment transactions for a particular peer. */
|
|
#ifndef LIGHTNING_LIGHTNINGD_PEER_HTLCS_H
|
|
#define LIGHTNING_LIGHTNINGD_PEER_HTLCS_H
|
|
#include "config.h"
|
|
#include <ccan/short_types/short_types.h>
|
|
#include <common/channel_config.h>
|
|
#include <common/derive_basepoints.h>
|
|
#include <common/htlc_wire.h>
|
|
|
|
struct channel;
|
|
struct htlc_in;
|
|
struct htlc_in_map;
|
|
struct htlc_out;
|
|
struct htlc_out_map;
|
|
struct htlc_stub;
|
|
struct lightningd;
|
|
struct forwarding;
|
|
struct json_stream;
|
|
|
|
/* FIXME: Define serialization primitive for this? */
|
|
struct channel_info {
|
|
struct channel_config their_config;
|
|
struct pubkey remote_fundingkey;
|
|
struct basepoints theirbase;
|
|
/* The old_remote_per_commit is for the locked-in remote commit_tx,
|
|
* and the remote_per_commit is for the commit_tx we're modifying now. */
|
|
struct pubkey remote_per_commit, old_remote_per_commit;
|
|
struct fee_states *fee_states;
|
|
};
|
|
|
|
/* Get all HTLCs for a peer, to send in init message. */
|
|
const struct existing_htlc **peer_htlcs(const tal_t *ctx,
|
|
const struct channel *channel);
|
|
|
|
void free_htlcs(struct lightningd *ld, const struct channel *channel);
|
|
|
|
void peer_sending_commitsig(struct channel *channel, const u8 *msg);
|
|
void peer_got_commitsig(struct channel *channel, const u8 *msg);
|
|
void peer_got_revoke(struct channel *channel, const u8 *msg);
|
|
|
|
void update_per_commit_point(struct channel *channel,
|
|
const struct pubkey *per_commitment_point);
|
|
|
|
/* Returns NULL on success, otherwise failmsg (and sets *needs_update_appended)*/
|
|
const u8 *send_htlc_out(const tal_t *ctx,
|
|
struct channel *out,
|
|
struct amount_msat amount, u32 cltv,
|
|
const struct sha256 *payment_hash,
|
|
const struct pubkey *blinding,
|
|
u64 partid,
|
|
const u8 *onion_routing_packet,
|
|
struct htlc_in *in,
|
|
struct htlc_out **houtp,
|
|
bool *needs_update_appended);
|
|
|
|
void onchain_failed_our_htlc(const struct channel *channel,
|
|
const struct htlc_stub *htlc,
|
|
const char *why);
|
|
void onchain_fulfilled_htlc(struct channel *channel,
|
|
const struct preimage *preimage);
|
|
|
|
void htlcs_notify_new_block(struct lightningd *ld, u32 height);
|
|
|
|
/* Only defined if COMPAT_V061 */
|
|
void fixup_htlcs_out(struct lightningd *ld);
|
|
|
|
void htlcs_resubmit(struct lightningd *ld,
|
|
struct htlc_in_map *unconnected_htlcs_in);
|
|
|
|
/* For HTLCs which terminate here, invoice payment calls one of these. */
|
|
void fulfill_htlc(struct htlc_in *hin, const struct preimage *preimage);
|
|
void local_fail_in_htlc(struct htlc_in *hin, const u8 *failmsg TAKES);
|
|
void local_fail_in_htlc_needs_update(struct htlc_in *hin,
|
|
const u8 *failmsg_needs_update TAKES,
|
|
const struct short_channel_id *failmsg_scid);
|
|
|
|
/* This json process will be used as the serialize method for
|
|
* forward_event_notification_gen and be used in
|
|
* `listforwardings_add_forwardings()`. */
|
|
void json_format_forwarding_object(struct json_stream *response, const char *fieldname,
|
|
const struct forwarding *cur);
|
|
|
|
/* Helper to create (common) WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS */
|
|
const u8 *failmsg_incorrect_or_unknown(const tal_t *ctx,
|
|
struct lightningd *ld,
|
|
const struct htlc_in *hin);
|
|
#endif /* LIGHTNING_LIGHTNINGD_PEER_HTLCS_H */
|