Commit Graph

40 Commits

Author SHA1 Message Date
Jan Sarenik 96f28323bd Set default port according to network
The idea is to have different default ports for different networks.

Current default port is `9735` for everything. Let's use it for
the mainnet and reuse the difference added to the default port
from `rpc_port` values in `bitcoin/chainstate.c`.

Testnet would be `19735` (adding rpc_port - 8332 = `10000`).

Signet would be `39735` (adding rpc_port - 8332 = `30000`).

Regtest would be `19846` (adding rpc_port - 8332 = `10111`).

With Vincenzo's kind pair-programming help over tmate.

Two other commits were squashed into this one so that bisecting
never ends up in half-baked state:

1. chainparams: Fix regtest default rpc_port

   bitcoind -help says this:

    -rpcport=<port>
         Listen for JSON-RPC connections on <port> (default: 8332, testnet:
         18332, signet: 38332, regtest: 18443)

2. test_gossip: Default port for regtest

   hex: 2607 is now .... (could be 4d86 but Elements uses another port)
   dec: 9735 is now any port (could be 19846 ^^ but now is for any port)

   The lines which were binding to default port were removed as the
   default port is different on each network.

NOTE: Remember not to modify gossip_store tests which loads everything raw
      including the checksums.

Changelog-Changed: If the port is unspecified, the default port is chosen according to used network similarly to Bitcoin Core.
2021-12-06 17:10:08 +10:30
Rusty Russell d9968bbc0c bitcoin: remove unused functions, or make static.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-12-06 10:05:39 +10:30
Rusty Russell 4ffda340d3 check: make sure all files outside contrib/ include "config.h" first.
And turn "" includes into full-path (which makes it easier to put
config.h first, and finds some cases check-includes.sh missed
previously).

config.h sets _GNU_SOURCE which really needs to be done before any
'#includes': we mainly got away with it with glibc, but other platforms
like Alpine may have stricter requirements.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-12-06 10:05:39 +10:30
ZmnSCPxj jxPCSnmZ a642d9f3dc bitcoin/chainparams.c: Change `signet` BIP173 name to `tbs`.
Fixes: #4924

ChangeLog-Changed: `signet` addresses and invoices now use `tbs` instead of `tb`.
2021-11-27 19:17:56 +01:00
Rusty Russell 7401b26824 cleanup: remove unneeded includes in C files.
Before:
 Ten builds, laptop -j5, no ccache:

```
real	0m36.686000-38.956000(38.608+/-0.65)s
user	2m32.864000-42.253000(40.7545+/-2.7)s
sys	0m16.618000-18.316000(17.8531+/-0.48)s
```

 Ten builds, laptop -j5, ccache (warm):

```
real	0m8.212000-8.577000(8.39989+/-0.13)s
user	0m12.731000-13.212000(12.9751+/-0.17)s
sys	0m3.697000-3.902000(3.83722+/-0.064)s
```

After:
 Ten builds, laptop -j5, no ccache: 8% faster

```
real	0m33.802000-35.773000(35.468+/-0.54)s
user	2m19.073000-27.754000(26.2542+/-2.3)s
sys	0m15.784000-17.173000(16.7165+/-0.37)s
```

 Ten builds, laptop -j5, ccache (warm): 1% faster

```
real	0m8.200000-8.485000(8.30138+/-0.097)s
user	0m12.485000-13.100000(12.7344+/-0.19)s
sys	0m3.702000-3.889000(3.78787+/-0.056)s
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-17 09:43:22 +09:30
Rusty Russell ea30c34d82 cleanup: remove unneeded includes in header files.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-17 09:43:22 +09:30
Dr. Maxim Orlovsky 0b01a5d7c4 Updating signet chainparams for the latest PoW fix
Changelog-Fixed: Protocol: `signet` is now compatible with the final bitcoin-core version
2020-09-24 09:24:14 +09:30
Rusty Russell 1356700e2b bitcoin/chainparams: signet uses the same P2PKH and P2SH version bytes as testnet.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-24 09:24:14 +09:30
Rusty Russell 27220646c3 common/wire: move bitcoin-specific marshalling functions into bitcoin files.
We did this originally because these types are referred to in the bolts, and we
had no way of injecting the correct include lines into those.  Now we do, so
there's less excuse for this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-05-18 14:51:12 +02:00
darosior 4b13b88f6c bitcoin/chainparams: add an utility to retrieve chainparams for all networks 2019-11-29 21:17:08 +01:00
Christian Decker d0708a483a chainparams: Add liquid_fee_asset to determine which asset pays fees
This is required since liquid-regtest and liquidv1 have different asset tags
for L-BTC which is the fee-paying asset.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-10-03 04:32:57 +00:00
Christian Decker 9e333f2416 elements: Add liquidv1 mainnet chainparams
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-10-03 04:32:57 +00:00
Christian Decker cd93a855ce elements: Give pytest some information about the test chain
We are checking against chain-dependent constants, so let's make sure we are
using the ones for the correct chain.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-10-03 04:32:57 +00:00
Christian Decker a300dea7e6 elements: Global variable whether we are running on elements
Using a global variable is a bit lazy, but weaving the network type through
the entire stack is a daunting task. Maybe we can make that happen at a later
stage.

Most of the changes in `chainparams.c` are just formatting the
`genesis_blockhash` a bit nicer (`clang-format` to the rescue).

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-10-03 04:32:57 +00:00
Christian Decker b9d7731100 chainparams: Add liquid-regtest as a supported network
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-10-03 04:32:57 +00:00
Karl-Johan Alm 46c184a50e signet: update genesis hash to use new POW-valid version 2019-08-19 07:09:06 +00:00
trueptolemy cdbfa4229c bitcoin: Add the `cli_min_supported_version` field in `chainparams`
Set the min supported numeric version of cli as 150000.
2019-07-30 17:38:54 +08:00
Karl-Johan Alm 918e130448 add signet support 2019-07-22 16:38:32 -05:00
Karl-Johan Alm ff2bfe3bdb dynamically generate string of network names 2019-07-22 16:38:32 -05:00
trueptolemy 285da33e9e Chainparam: Add 'bip70_name' field for blockchain
'bip70_name' is corresponding to the 'chain' field of
the API 'getblockchaininfo'.
At the beginning of lightningd, we use the 'chain' field of 'getblockchaininfo' to check if we are on right blockchain.
2019-07-04 16:13:09 +02:00
Christian Decker 6d618511fc chainparams: Add p2pkh and p2sh versions to chinparams
Signed-off-by: Christian Decker <decker.christian@gmail.com>
Co-authored-by: bisoge <bisoge@gmx.de>
2019-05-01 12:37:30 +02:00
trueptolemy 92c08cd861 Fix the version of bip32 private_key generation
We set the version BIP32_VER_TEST_PRIVATE for testnet/regtest
BIP32 privkey generation with libwally-core, and set
BIP32_VER_MAIN_PRIVATE for mainnet.
For litecoin, we also set it like bitcoin else.
2019-03-18 02:47:04 +00:00
Rusty Russell 02faadfb93 amount: make it work with gcc-4.8.
```
In file included from bitcoin/chainparams.h:7:0,from bitcoin/chainparams.c:1:
./common/amount.h:36:11: error: initializer element is not constant
((struct amount_sat){(constant) + AMOUNT_MUST_BE_CONST(constant)})
^
bitcoin/chainparams.c:20:21: note: in expansion of macro ‘AMOUNT_SAT’
.max_funding = AMOUNT_SAT((1 << 24) - 1),
^
./common/amount.h:36:11: error: (near initialization for ‘networks[0].max_funding’)
((struct amount_sat){(constant) + AMOUNT_MUST_BE_CONST(constant)})
^
bitcoin/chainparams.c:20:21: note: in expansion of macro ‘AMOUNT_SAT’
.max_funding = AMOUNT_SAT((1 << 24) - 1),
```

Fixes: #2404
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-27 23:12:50 +00:00
Rusty Russell 85b8b25749 bitcoin/chainparams: use amount_sat / amount_msat
Simple changes, but ripples through the code.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-21 08:01:37 +00:00
Christian Decker e10cde3516 chainparams: Remove index from chainparams
We no longer use it to reference chainparams, so we can remove it completely.
2018-09-14 21:18:11 +02:00
Christian Decker f417dfa0e1 chainparams: Always retrieve chainparams by the chain_hash 2018-09-14 21:18:11 +02:00
Christian Decker 2d7e603ac1 chainparams: Move the BOLT2 quote to the chainparams where we set it 2018-09-14 21:18:11 +02:00
Christian Decker 8d95917e7c chainparams: Add max_funding_satoshi and max_payment_msat to chainparams 2018-09-14 21:18:11 +02:00
Saibato 09407b9fd8 fix Litecoin testnet bip173 name
Signed-off-by: Saibato <saibato.naga@protonmail.com>
2018-05-03 14:09:50 +02:00
nicolas.dorier e36cf354aa Update when_lightning_became_cool for LTC 2018-04-27 13:59:19 +02:00
Rusty Russell 6620305606 wallet: use last_processed_block to determine scan start.
With fallback depending on chainparams: this means the first upgrade
will be slow, but after that it'll be fast.

Fixes: #990
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-16 13:07:12 +01:00
Luca Vaccaro 4dac2da8fc Fix litecoin mainnet & testnet chainparams 2018-02-14 15:26:27 +01:00
William Casarin b30fb952e6 chainparams: fix regtest bip173_name
regtest bech32 hrp is bcrt, not tb

Signed-off-by: William Casarin <jb55@jb55.com>
2018-02-06 01:37:58 +00:00
Luca Vaccaro af26c91a2c Add litecoin testnet support 2018-01-28 13:56:28 +01:00
Rusty Russell 810abb6b21 bitcoin: create new wrapper type bitcoin_blkid, log backward endianness.
It's just a sha256_double, but importantly when we convert it to a
string (in type_to_string, which is used in logging) we use
bitcoin_blkid_to_hex() so it's reversed as people expect.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-21 11:05:38 +00:00
Rusty Russell 58604a0497 chainparams: add bip173 name.
Google lead me to a discussion about litecint, it suggested they would use
'ltc' and I don't really care.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-01 01:09:23 +00:00
Rusty Russell 56d89b02c7 chainparams: fix order of chain hashes.
See https://github.com/lightningnetwork/lightning-rfc/issues/237

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-09-05 00:35:38 +02:00
Christian Decker f085a474b2 fix: Only add cli_args if we have some defined
This was causing calls to `bitcoin-cli` to fail on mainnet since it
was interpreting the empty string as the RPC method to call.
2017-08-13 13:57:48 +09:30
Christian Decker 5fdb8a58aa fix: Addressing feedback from PR #192 2017-07-12 13:16:00 +02:00
Christian Decker df056e5973 bitcoin: Added chainparams grouping blockchain specific parameters 2017-07-12 11:30:23 +09:30