mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
f1bea55395
I was working on rewriting our (somewhat chaotic) tx watching code for 0.7.2, when I found this bug: we don't always notice the funding tx in corner cases where more than one block is detected at once. This is just the one commit needed to fix the problem: it has some unnecessary changes, but I'd prefer not to diverge too far from my cleanup-txwatch branch. Fixes: #2352 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
73 lines
2.5 KiB
C
73 lines
2.5 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;
|
|
|
|
/* 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;
|
|
/* In transition, these can be different! */
|
|
u32 feerate_per_kw[NUM_SIDES];
|
|
};
|
|
|
|
/* Get all HTLCs for a peer, to send in init message. */
|
|
void peer_htlcs(const tal_t *ctx,
|
|
const struct channel *channel,
|
|
struct added_htlc **htlcs,
|
|
enum htlc_state **htlc_states,
|
|
struct fulfilled_htlc **fulfilled_htlcs,
|
|
enum side **fulfilled_sides,
|
|
const struct failed_htlc ***failed_htlcs,
|
|
enum side **failed_sides);
|
|
|
|
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);
|
|
|
|
enum onion_type send_htlc_out(struct channel *out,
|
|
struct amount_msat amount, u32 cltv,
|
|
const struct sha256 *payment_hash,
|
|
const u8 *onion_routing_packet,
|
|
struct htlc_in *in,
|
|
struct htlc_out **houtp);
|
|
|
|
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);
|
|
|
|
void htlcs_reconnect(struct lightningd *ld,
|
|
struct htlc_in_map *htlcs_in,
|
|
struct htlc_out_map *htlcs_out);
|
|
|
|
/* For HTLCs which terminate here, invoice payment calls one of these. */
|
|
void fulfill_htlc(struct htlc_in *hin, const struct preimage *preimage);
|
|
void fail_htlc(struct htlc_in *hin, enum onion_type failcode);
|
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_PEER_HTLCS_H */
|