2017-08-28 18:06:01 +02:00
|
|
|
#ifndef LIGHTNING_COMMON_CHANNEL_CONFIG_H
|
|
|
|
#define LIGHTNING_COMMON_CHANNEL_CONFIG_H
|
2017-02-07 02:44:21 +01:00
|
|
|
#include "config.h"
|
2019-02-21 04:45:54 +01:00
|
|
|
#include <common/amount.h>
|
2017-02-07 02:44:21 +01:00
|
|
|
|
|
|
|
/* BOLT #2:
|
|
|
|
*
|
|
|
|
* 1. type: 32 (`open_channel`)
|
|
|
|
* 2. data:
|
2019-07-16 01:20:37 +02:00
|
|
|
* * [`chain_hash`:`chain_hash`]
|
|
|
|
* * [`32*byte`:`temporary_channel_id`]
|
|
|
|
* * [`u64`:`funding_satoshis`]
|
|
|
|
* * [`u64`:`push_msat`]
|
|
|
|
* * [`u64`:`dust_limit_satoshis`]
|
|
|
|
* * [`u64`:`max_htlc_value_in_flight_msat`]
|
|
|
|
* * [`u64`:`channel_reserve_satoshis`]
|
|
|
|
* * [`u64`:`htlc_minimum_msat`]
|
|
|
|
* * [`u32`:`feerate_per_kw`]
|
|
|
|
* * [`u16`:`to_self_delay`]
|
|
|
|
* * [`u16`:`max_accepted_htlcs`]
|
2017-02-07 02:44:21 +01:00
|
|
|
*...
|
|
|
|
* 1. type: 33 (`accept_channel`)
|
|
|
|
* 2. data:
|
2019-07-16 01:20:37 +02:00
|
|
|
* * [`32*byte`:`temporary_channel_id`]
|
|
|
|
* * [`u64`:`dust_limit_satoshis`]
|
|
|
|
* * [`u64`:`max_htlc_value_in_flight_msat`]
|
|
|
|
* * [`u64`:`channel_reserve_satoshis`]
|
|
|
|
* * [`u64`:`htlc_minimum_msat`]
|
|
|
|
* * [`u32`:`minimum_depth`]
|
|
|
|
* * [`u16`:`to_self_delay`]
|
|
|
|
* * [`u16`:`max_accepted_htlcs`]
|
2017-02-07 02:44:21 +01:00
|
|
|
*/
|
|
|
|
struct channel_config {
|
2017-08-05 14:45:42 +02:00
|
|
|
/* Database ID */
|
|
|
|
u64 id;
|
2018-11-21 04:11:03 +01:00
|
|
|
/* BOLT #2:
|
|
|
|
*
|
|
|
|
* `dust_limit_satoshis` is the threshold below which outputs should
|
|
|
|
* not be generated for this node's commitment or HTLC transaction */
|
2019-02-21 04:45:54 +01:00
|
|
|
struct amount_sat dust_limit;
|
2018-11-21 04:11:03 +01:00
|
|
|
|
|
|
|
/* BOLT #2:
|
|
|
|
*
|
|
|
|
* `max_htlc_value_in_flight_msat` is a cap on total value of
|
|
|
|
* outstanding HTLCs, which allows a node to limit its exposure to
|
|
|
|
* HTLCs */
|
2019-02-21 04:45:54 +01:00
|
|
|
struct amount_msat max_htlc_value_in_flight;
|
2018-11-21 04:11:03 +01:00
|
|
|
|
|
|
|
/* BOLT #2:
|
|
|
|
*
|
|
|
|
* `channel_reserve_satoshis` is the minimum amount that the other
|
|
|
|
* node is to keep as a direct payment. */
|
2019-02-21 04:45:54 +01:00
|
|
|
struct amount_sat channel_reserve;
|
2018-11-21 04:11:03 +01:00
|
|
|
|
|
|
|
/* BOLT #2:
|
|
|
|
*
|
|
|
|
* `htlc_minimum_msat` indicates the smallest value HTLC this node
|
|
|
|
* will accept.
|
|
|
|
*/
|
2019-02-21 04:45:54 +01:00
|
|
|
struct amount_msat htlc_minimum;
|
2018-11-21 04:11:03 +01:00
|
|
|
|
|
|
|
/* BOLT #2:
|
|
|
|
*
|
|
|
|
* `to_self_delay` is the number of blocks that the other node's
|
|
|
|
* to-self outputs must be delayed, using `OP_CHECKSEQUENCEVERIFY`
|
|
|
|
* delays */
|
2017-02-07 02:44:21 +01:00
|
|
|
u16 to_self_delay;
|
2018-11-21 04:11:03 +01:00
|
|
|
|
|
|
|
/* BOLT #2:
|
|
|
|
*
|
|
|
|
* similarly, `max_accepted_htlcs` limits the number of outstanding
|
|
|
|
* HTLCs the other node can offer. */
|
2017-02-07 02:44:21 +01:00
|
|
|
u16 max_accepted_htlcs;
|
2021-09-28 21:03:08 +02:00
|
|
|
|
|
|
|
/* BOLT-TBD #X
|
|
|
|
*
|
|
|
|
* maximum dust exposure allowed for this channel
|
|
|
|
*/
|
|
|
|
struct amount_msat max_dust_htlc_exposure_msat;
|
2017-02-07 02:44:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
void towire_channel_config(u8 **pptr, const struct channel_config *config);
|
2017-02-21 05:45:19 +01:00
|
|
|
void fromwire_channel_config(const u8 **ptr, size_t *max,
|
|
|
|
struct channel_config *config);
|
2017-08-28 18:06:01 +02:00
|
|
|
#endif /* LIGHTNING_COMMON_CHANNEL_CONFIG_H */
|