Repository navigation
config: allow the neutrino backend - #3
Conversation
|
Thanks for this, and for testing it end to end. I ran it too: the PR build I'd like to take it, but a few things need to change first. Where the code comes from. I don't want a release to build btcd and
Then this PR, rebased on Two fixes in the neutrino fork:
Smaller ones, fine as follow-ups:
Changes in this PR:
Neither package (StartOS, Umbrel) offers neutrino today, since both set |
41ccb5c to
d7e5c90
Compare
|
Thanks for the careful review. I've rebased onto Where the code comes from
Changes in this PR
Run on regtest (Knots v29.4.2,
I haven't run it against mainnet peers yet; our Knots node isn't serving filters to peers yet. |
|
One more commit, found while testing the SHA256d case. A daemon still waiting for the backend to reach the activation height didn't stop on SIGTERM. The wait only watched the chain control's own quit channel, which is closed after it returns. That was already the case with bitcoind (a node that never gets there). With neutrino it's easier to hit, because a node whose only peers are SHA256d ones bans them all and waits at 0 headers. The wait now also ends on the interceptor's shutdown ( |
|
Mainnet run. Our Knots node (v29.4.2) now serves filters (
|
|
Thanks, this addresses the review point by point: the checkpoint at 961640, chain-identity.json under neutrino, the connect rule, validatechannels on by default, and the docs all look right. It also cherry-picks cleanly onto blake2b-next 9cbe408, and the build and the chainreg, lncfg and config tests pass there. What's left:
If you can, a short regtest run with v2 headers through the final build would be good before release. Thanks again for the careful work. |
|
One more small thing from CI: the fork checks fail on formatting only. |
|
Thanks. 2 to 4 and the gofmt are in (76607e3, 01a5e6f); 1 and the regtest run follow the neutrino tag:
|
|
Thanks for these. I confirmed the BanDuration point (48 hours in One problem: the new check at neutrino-blake2b#1 is merged and tagged as v0.17.1-blake2b.1, so go.mod can now point at |
neutrino now validates BLAKE2b proof of work itself from btcd's Blake2bHeight, so it is no longer refused. A peer on the SHA256d chain fails at the activation height, where its headers are still v1, so no chain-identity check is needed for it. On regtest and simnet the configured activation height is copied into the btcd parameters handed to neutrino (on a copy of them). Without a known height neutrino is refused.
…er neutrino The light client would follow any most-work chain that passes the BLAKE2b rules from the activation height. On mainnet it now gets a checkpoint at 961640 with the pinned activation hash, on a copy of the parameters, and once its headers reach the activation height the chain-identity check runs against them (through a small adapter that answers the check's calls from neutrino's validated headers) and writes chain-identity.json, as the bitcoind path does.
- mainnet and testnet4 need neutrino.connect: the DNS seeds return SHA256d nodes; addpeer alone is allowed with a warning - neutrino.validatechannels defaults to true; routing.assumechanvalid=true turns it off - the header import is refused: it reads 80-byte headers only - testnet4 takes btcd's built-in activation height for the check - bitcoin.blake2b-activation-height is range-checked before int32 - the unknown-backend error lists neutrino - tests for the above, and that regtest/simnet without a height refuse
Pseudo-version of paulscode/neutrino-blake2b#1 until it is merged and tagged v0.17.1-blake2b.1.
A daemon still waiting for its backend to reach the activation height did not stop on SIGTERM: the wait only watched the chain control's own quit channel, which is closed after it returns. That was already so with bitcoind; with neutrino it is easier to hit (only SHA256d peers, all banned). The wait now also ends on the interceptor's shutdown.
…ts index is ahead of the file)
…channels help and the docs checkNeutrinoBlake2b now refuses mainnet neutrino without fee.url, so it fails at start rather than after the sync to the BLAKE2b activation height (where chainreg checks it). The validatechannels help (and sample-lnd.conf) says it is on by default here, that =false only takes effect in the config file, and that routing.assumechanvalid=true turns it off from the command line. docs/blake2b.md: the SHA256 chain's DNS seeds, and bans that last 48 hours (lnd sets neutrino's ban duration to that) with persistent peers only disconnected. gofmt on config_blake2b.go.
checkNeutrinoBlake2b refused a mainnet neutrino node without fee.url, but chainreg copies the deprecated feeurl option into fee.url only later, when it builds the fee estimator. A node that still set feeurl= was refused at start although it had a fee URL. Accept either, and test feeurl alone.
neutrino-blake2b#1 is merged and tagged; point the replace at github.com/paulscode/neutrino-blake2b v0.17.1-blake2b.1 instead of the commit on our fork.
lnd's linter counts a tab as 8 columns. Wrap the lines this branch added past that, in the config, the config builder, chainreg and their tests.
01a5e6f to
a879f42
Compare
|
Both points are in (a879f42):
The regtest run with v2 headers follows; I'll post the results here. |
|
Regtest run with v2 (164-byte BLAKE2b) headers, on the final build (a879f42):
|
|
Thanks for the thorough regtest run with v2 headers, and for all the rounds on this. Merged; it goes out in the next release. The cooperative close's first fee proposal is lnd's legacy closing_signed negotiation on regtest, as you say, not this PR. |
Lets lnd run with
bitcoin.node=neutrinoon the BLAKE2b chain. This builds on paulscode/btcd-blake2b#1 (BLAKE2b PoW validation in btcd) and on a neutrino change that stores 164-byte headers.Changes:
config.go: neutrino is no longer refused. It is still refused when the network's activation height is unknown.config_blake2b.go: on regtest and simnet the configuredbitcoin.blake2b-activation-heightis copied into the btcd params handed to neutrino. The copy leaves the package-level params untouched. Mainnet and testnet4 use the heights in btcd's chaincfg.docs/blake2b.md: the backends section now covers neutrino. It needs peers that serve compact filters (blockfilterindex=1,peerblockfilters=1) set withneutrino.connect/addpeer, since DNS seeds don't know which nodes follow this chain.TestBackendChoicesRefusednow refuses only btcd, and a newTestNeutrinoBlake2bParamschecks the params handed to neutrino.go.mod: points btcd and neutrino at the branches below by pseudo-version. Once blockchain: validate BLAKE2b (header v2) proof of work btcd-blake2b#1 is tagged, and neutrino lives wherever you prefer (fork it or take ours), these should become proper versions:blake2b-pow(same commit as blockchain: validate BLAKE2b (header v2) proof of work btcd-blake2b#1)blake2b, from v0.17.1. The header file now holds 80-byte records below the activation height and 164-byte records from it, so offsets stay a formula.WriteHeadersrefuses a header whose format doesn't match its height. WithoutBlake2bHeightthe layout is unchanged, so existing files read the same.A neutrino node doesn't need the chain-identity check: a peer on the SHA256d chain fails at the activation height, because its headers there are still v1.
Tested on regtest (Knots v29.4.2,
testactivationheight=blake2b@150, filters on):The whole mainnet header chain also validates under the btcd change (see paulscode/btcd-blake2b#1). I haven't run neutrino against mainnet peers yet.