2016-08-18 14:23:45 +09:30
|
|
|
#ifndef LIGHTNING_DAEMON_PACKETS_H
|
|
|
|
#define LIGHTNING_DAEMON_PACKETS_H
|
|
|
|
#include "config.h"
|
|
|
|
#include "lightning.pb-c.h"
|
|
|
|
|
|
|
|
struct peer;
|
|
|
|
struct htlc;
|
|
|
|
struct sha256;
|
|
|
|
struct bitcoin_signature;
|
|
|
|
struct commit_info;
|
|
|
|
|
|
|
|
/* Send various kinds of packets */
|
2016-11-09 08:04:28 +10:30
|
|
|
void queue_pkt_open(struct peer *peer, bool offer_anchor);
|
2016-08-18 14:23:45 +09:30
|
|
|
void queue_pkt_anchor(struct peer *peer);
|
|
|
|
void queue_pkt_open_commit_sig(struct peer *peer);
|
|
|
|
void queue_pkt_open_complete(struct peer *peer);
|
|
|
|
void queue_pkt_htlc_add(struct peer *peer, struct htlc *htlc);
|
|
|
|
void queue_pkt_htlc_fulfill(struct peer *peer, struct htlc *htlc);
|
|
|
|
void queue_pkt_htlc_fail(struct peer *peer, struct htlc *htlc);
|
2016-08-26 15:31:19 +09:30
|
|
|
void queue_pkt_feechange(struct peer *peer, u64 feerate);
|
2016-08-18 14:25:08 +09:30
|
|
|
void queue_pkt_commit(struct peer *peer, const struct bitcoin_signature *sig);
|
2016-08-18 14:23:45 +09:30
|
|
|
void queue_pkt_revocation(struct peer *peer,
|
|
|
|
const struct sha256 *preimage,
|
|
|
|
const struct sha256 *next_hash);
|
2016-08-18 14:23:46 +09:30
|
|
|
void queue_pkt_close_shutdown(struct peer *peer);
|
2016-08-18 14:23:45 +09:30
|
|
|
void queue_pkt_close_signature(struct peer *peer);
|
2016-12-12 14:55:15 +01:00
|
|
|
void queue_pkt_nested(struct peer *peer, int type, const u8 *nested_pkt);
|
2016-08-18 14:23:45 +09:30
|
|
|
|
|
|
|
Pkt *pkt_err(struct peer *peer, const char *msg, ...);
|
2016-10-07 17:39:34 +10:30
|
|
|
Pkt *pkt_init(struct peer *peer, u64 ack);
|
2016-08-18 14:23:45 +09:30
|
|
|
void queue_pkt_err(struct peer *peer, Pkt *err);
|
|
|
|
Pkt *pkt_err_unexpected(struct peer *peer, const Pkt *pkt);
|
|
|
|
|
|
|
|
/* Process various packets: return an error packet on failure. */
|
|
|
|
Pkt *accept_pkt_open(struct peer *peer, const Pkt *pkt,
|
|
|
|
struct sha256 *revocation_hash,
|
|
|
|
struct sha256 *next_revocation_hash);
|
|
|
|
|
|
|
|
Pkt *accept_pkt_anchor(struct peer *peer, const Pkt *pkt);
|
|
|
|
|
|
|
|
Pkt *accept_pkt_open_commit_sig(struct peer *peer, const Pkt *pkt,
|
2016-11-04 11:17:04 +10:30
|
|
|
struct bitcoin_signature *sig);
|
2016-08-18 14:23:45 +09:30
|
|
|
|
|
|
|
Pkt *accept_pkt_open_complete(struct peer *peer, const Pkt *pkt);
|
2016-11-11 09:32:04 +10:30
|
|
|
|
2016-08-18 14:23:45 +09:30
|
|
|
Pkt *accept_pkt_htlc_add(struct peer *peer, const Pkt *pkt, struct htlc **h);
|
|
|
|
|
2016-09-02 12:02:18 +09:30
|
|
|
Pkt *accept_pkt_htlc_fail(struct peer *peer, const Pkt *pkt, struct htlc **h,
|
|
|
|
u8 **fail);
|
2016-08-18 14:23:45 +09:30
|
|
|
|
2016-08-18 14:25:08 +09:30
|
|
|
Pkt *accept_pkt_htlc_fulfill(struct peer *peer, const Pkt *pkt, struct htlc **h,
|
2016-09-02 12:01:18 +09:30
|
|
|
struct rval *r);
|
2016-08-18 14:23:45 +09:30
|
|
|
|
2016-08-26 15:33:30 +09:30
|
|
|
Pkt *accept_pkt_update_fee(struct peer *peer, const Pkt *pkt, u64 *feerate);
|
|
|
|
|
2016-08-18 14:23:45 +09:30
|
|
|
Pkt *accept_pkt_update_accept(struct peer *peer, const Pkt *pkt);
|
|
|
|
|
|
|
|
Pkt *accept_pkt_commit(struct peer *peer, const Pkt *pkt,
|
|
|
|
struct bitcoin_signature *sig);
|
|
|
|
|
2016-08-18 14:23:46 +09:30
|
|
|
Pkt *accept_pkt_revocation(struct peer *peer, const Pkt *pkt);
|
2016-08-18 14:23:45 +09:30
|
|
|
|
2016-08-18 14:23:46 +09:30
|
|
|
Pkt *accept_pkt_close_shutdown(struct peer *peer, const Pkt *pkt);
|
2016-08-18 14:23:45 +09:30
|
|
|
|
|
|
|
#endif /* LIGHTNING_DAEMON_PACKETS_H */
|