mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-20 10:39:49 +01:00
d86855d1f7
This notification will be raised whenever a channel state changes. The payload includes the channel and peer identifiers and the old and the new state. Example payload: ``` { "channel_state_changed": { "peer_id": "03bc9337c7a28bb784d67742ebedd30a93bacdf7e4ca16436ef3798000242b2251", "channel_id": "a2d0851832f0e30a0cf778a826d72f077ca86b69f72677e0267f23f63a0599b4", "short_channel_id" : "561820x1020x1", "old_state": "CHANNELD_NORMAL", "new_state": "AWAITING_UNILATERAL" } } ``` Changelog-Added: Plugins: channel_state_changed notification
90 lines
3.1 KiB
C
90 lines
3.1 KiB
C
#ifndef LIGHTNING_LIGHTNINGD_NOTIFICATION_H
|
|
#define LIGHTNING_LIGHTNINGD_NOTIFICATION_H
|
|
#include "config.h"
|
|
#include <bitcoin/short_channel_id.h>
|
|
#include <bitcoin/tx.h>
|
|
#include <ccan/autodata/autodata.h>
|
|
#include <ccan/json_escape/json_escape.h>
|
|
#include <ccan/time/time.h>
|
|
#include <common/amount.h>
|
|
#include <common/channel_id.h>
|
|
#include <common/coin_mvt.h>
|
|
#include <common/errcode.h>
|
|
#include <common/node_id.h>
|
|
#include <lightningd/channel_state.h>
|
|
#include <lightningd/htlc_end.h>
|
|
#include <lightningd/jsonrpc.h>
|
|
#include <lightningd/lightningd.h>
|
|
#include <lightningd/log.h>
|
|
#include <lightningd/pay.h>
|
|
#include <lightningd/plugin.h>
|
|
#include <wallet/wallet.h>
|
|
#include <wire/onion_wire.h>
|
|
|
|
struct onionreply;
|
|
|
|
bool notifications_have_topic(const char *topic);
|
|
|
|
struct notification {
|
|
const char *topic;
|
|
/* the serialization interface */
|
|
void *serialize;
|
|
};
|
|
|
|
AUTODATA_TYPE(notifications, struct notification);
|
|
|
|
/* FIXME: Find a way to avoid back-to-back declaration and definition */
|
|
#define REGISTER_NOTIFICATION(topic, serialize) \
|
|
struct notification topic##_notification_gen = { \
|
|
stringify(topic), \
|
|
serialize, \
|
|
}; \
|
|
AUTODATA(notifications, &topic##_notification_gen);
|
|
|
|
void notify_connect(struct lightningd *ld, struct node_id *nodeid,
|
|
struct wireaddr_internal *addr);
|
|
void notify_disconnect(struct lightningd *ld, struct node_id *nodeid);
|
|
|
|
void notify_warning(struct lightningd *ld, struct log_entry *l);
|
|
|
|
void notify_invoice_payment(struct lightningd *ld, struct amount_msat amount,
|
|
struct preimage preimage, const struct json_escape *label);
|
|
|
|
void notify_invoice_creation(struct lightningd *ld, struct amount_msat *amount,
|
|
struct preimage preimage, const struct json_escape *label);
|
|
|
|
void notify_channel_opened(struct lightningd *ld, struct node_id *node_id,
|
|
struct amount_sat *funding_sat, struct bitcoin_txid *funding_txid,
|
|
bool *funding_locked);
|
|
|
|
void notify_channel_state_changed(struct lightningd *ld,
|
|
struct node_id *peer_id,
|
|
struct channel_id *cid,
|
|
struct short_channel_id *scid,
|
|
enum channel_state old_state,
|
|
enum channel_state new_state);
|
|
|
|
void notify_forward_event(struct lightningd *ld,
|
|
const struct htlc_in *in,
|
|
/* May be NULL if we don't know. */
|
|
const struct short_channel_id *scid_out,
|
|
/* May be NULL. */
|
|
const struct amount_msat *amount_out,
|
|
enum forward_status state,
|
|
enum onion_wire failcode,
|
|
struct timeabs *resolved_time);
|
|
|
|
void notify_sendpay_success(struct lightningd *ld,
|
|
const struct wallet_payment *payment);
|
|
|
|
void notify_sendpay_failure(struct lightningd *ld,
|
|
const struct wallet_payment *payment,
|
|
errcode_t pay_errcode,
|
|
const struct onionreply *onionreply,
|
|
const struct routing_failure *fail,
|
|
const char *errmsg);
|
|
|
|
void notify_coin_mvt(struct lightningd *ld,
|
|
const struct coin_mvt *mvt);
|
|
#endif /* LIGHTNING_LIGHTNINGD_NOTIFICATION_H */
|