Set default port according to network#4900
Conversation
|
Overall idea is that command-line specified port always takes precedence, but if it is not set then the port From Bitcoin Core And that means the differences to the default mainnet port are what the new variable UPDATE: Simplified using an already-defined |
|
@rustyrussell I need help. Shell-scripting mindset seems to be of little use here :) UPDATE: Got help from @vincenzopalazzo |
a563cb6 to
8605695
Compare
2e02ee7 to
6ba8215
Compare
|
Vincenzo says this change may need some change in the specs. |
Just suggested how to fix the segmentation fault :) nothing else
I like the idea to have some standards also on different ports, like testnet, request but (maybe not for liquid or different network like litecoin?) |
vincenzopalazzo
left a comment
There was a problem hiding this comment.
LGTM.
I like your proposal, I have only a question on how to derive the lightning port from the bitcoin port standard, and also add a check to avoid the overriding of a custom port.
| @@ -34,6 +34,7 @@ const struct chainparams networks[] = { | |||
| 0x5a, 0x08, 0x9c, 0x68, 0xd6, 0x19, 0x00, | |||
There was a problem hiding this comment.
I really like to have this type of offset for the network port, and I think that using this technique is pretty good. However, I things in this case we are mixing the bitcoin config with only one propriety related to c-lightning.
However, we can derive your offset from the following formula lightning_port = defautl_lightning_port + (bitcoin_network_port - bitcoin_mainet_port). As an example we can have the following example:
lightning_port = 9735 + (18332 - 8332) where we will have that the lightning port is 19735.
What do you think?
There was a problem hiding this comment.
Sure. This is much cleaner than my pre-processed constants (10000, etc.).
There was a problem hiding this comment.
So do you recommend to do port_add = 18332 - 8332 instead of port_add = 10000?
There was a problem hiding this comment.
Not sure how to implement it, the mine was only an idea to derive the standard network port of lightning from what we have defined in the bitcoins. However, we need to manage also the corner case here, and maybe the case is too much.
I need to think about that
There was a problem hiding this comment.
What's the corner case? I tested it on mainnet and signet. And also with a port 12345 specified on the command line. Works well.
There was a problem hiding this comment.
And now with a comment: 17a66f4
Enough. Will wait for feed-back now.
There was a problem hiding this comment.
See where one test was fixed along with the rpc_port for regtest network.
6ba8215 to
01efd37
Compare
|
@cdecker please have a look and comment. |
b525259 to
17a66f4
Compare
|
This may be a breaking change for anyone who used the default port |
5a81a9e to
9c4bdb0
Compare
|
This is going to be bigger than few-lines-patch :)
|
85d2737 to
aaf1dbf
Compare
|
@cdecker the FreeBSD test ends with following: |
|
Yep, that's a flake, given the VM has some timing issues. Kicking CI 👍 |
|
@cdecker please kick it once again. Just one Normal Test timed-out now. UPDATE: That was actually the Elements test because with Elements the default port would be different than with regtest. The test was changed accordingly (to accept any port now |
efe8194 to
2949bfe
Compare
vincenzopalazzo
left a comment
There was a problem hiding this comment.
The other CI failure looks unrelated, but I'm not sure
2c86386 to
26a319e
Compare
vincenzopalazzo
left a comment
There was a problem hiding this comment.
LGTM overall but I have a small missing in the test_gossip.py
26a319e to
3a80abb
Compare
|
The last CI run failed on this: https://github.com/ElementsProject/lightning/runs/4421365349?check_suite_focus=true. Re-running. |
3a80abb to
5738b63
Compare
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.
Also nit: s/possible/possibly suggested by michaelfolkson.
5738b63 to
51ce5bb
Compare
|
It seems to me that "Flaky Tests" should be taken out of the regular CI runs and run separately on regular basis with opt-in reporting (for whoever likes to receive Flaky Test failures). This way it would not block or confuse anyone and still whoever wants the results will get them and may use them for what they are worth. |
No, flaky tests should be fixed. But it's often an ongoing battle, to detect whether it's a test flake, or a real intermittent issue. And it also doesn't happen on my test boxes :( |
|
I will apply this, as it's been sitting here too long, and restore the default-port-is-correct test as a separate commit. Ack 51ce5bb |
Just a reminder that this needs a change to BOLT 1 (maybe worth opening a spec PR and/or discussing in the spec meeting @vincenzopalazzo @jsarenik?) |
This is something that I think for a while, but I don't have time to know how bitcoin core remove the default port bitcoin/bitcoin#23306 I will check this week, Thanks for pinging on this point! |
|
Opened a draft on the Spec lightning/bolts#968 I will review the text in the next few days to avoid different typos e improve the English form. |
The idea is to have different default ports for different networks.
Current default port is
9735for everything. Let's use it forthe mainnet and reuse the difference added to the default port
from
rpc_portvalues inbitcoin/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 pair-programming help.
Changelog-Changed: If the port is unspecified, the default port is chosen according to used network similarly to Bitcoin Core.