forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chainparams.h
84 lines (74 loc) · 2.58 KB
/
chainparams.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef LIGHTNING_BITCOIN_CHAINPARAMS_H
#define LIGHTNING_BITCOIN_CHAINPARAMS_H
#include "config.h"
#include <bitcoin/block.h>
#include <common/amount.h>
#include <common/bip32.h>
#define ELEMENTS_ASSET_LEN 33
struct chainparams {
const char *network_name;
/* Unfortunately starting with signet, we now have diverging
* conventions for the "BIP173" Human Readable Part (HRP).
* On onchain signet, the HRP is `tb` , but on Lightning
* signet the HRP is `tbs`.
*/
const char *onchain_hrp;
const char *lightning_hrp;
/*'bip70_name' is corresponding to the 'chain' field of
* the API 'getblockchaininfo' */
const char *bip70_name;
const struct bitcoin_blkid genesis_blockhash;
const int rpc_port;
/**
* BOLT 1:
*
* The default TCP port depends on the network used. The most common networks are:
*
* - Bitcoin mainet with port number 9735 or the corresponding hexadecimal `0x2607`;
* - Bitcoin testnet with port number 19735 (`0x4D17`);
* - Bitcoin signet with port number 39735 (`0xF87`).
*/
const int ln_port;
const char *cli;
const char *cli_args;
/* The min numeric version of cli supported */
const u64 cli_min_supported_version;
const struct amount_sat dust_limit;
const struct amount_sat max_funding;
const struct amount_msat max_payment;
/* Total coins in network */
const struct amount_sat max_supply;
const u32 when_lightning_became_cool;
const u8 p2pkh_version;
const u8 p2sh_version;
/* Whether this is a test network or not */
const bool testnet;
/* Version codes for BIP32 extended keys in libwally-core*/
const struct bip32_key_version bip32_key_version;
const bool is_elements;
const u8 *fee_asset_tag;
};
/**
* chainparams_for_network - Look up blockchain parameters by its name
*/
const struct chainparams *chainparams_for_network(const char *network_name);
/**
* chainparams_by_bip173 - Helper to get a network by its bip173 name
*
* This lets us decode BOLT11 addresses.
*/
const struct chainparams *chainparams_by_lightning_hrp(const char *lightning_hrp);
/**
* chainparams_by_chainhash - Helper to get a network by its genesis blockhash
*/
const struct chainparams *chainparams_by_chainhash(const struct bitcoin_blkid *chain_hash);
/**
* chainparams_get_network_names - Produce a comma-separated list of network names
*/
const char *chainparams_get_network_names(const tal_t *ctx);
/**
* chainparams_get_ln_port - Return the lightning network default port by
* network if the chainparams is initialized, otherwise 9735 as mock port
*/
int chainparams_get_ln_port(const struct chainparams *params);
#endif /* LIGHTNING_BITCOIN_CHAINPARAMS_H */