-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build+lncfg: support pruned bitcoind backends #5154
build+lncfg: support pruned bitcoind backends #5154
Conversation
#2997 suggests an alternative path where we control the pruning window instead, and I wasn't sure if we'd still want that. In any case, this branch should fully support pruned nodes by just fetching pruned blocks from peers. |
Ah gotcha, yeah I think this approach is superior as it doesn't require |
e33de2a
to
2dc080e
Compare
Needs a rebase! |
2dc080e
to
4d47c37
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🐊
Weird how it isn't showing conflicts for the commits duplicated here vs the pubkey import stuff just merged in? |
This is achieved by some recent work within the BitcoindClient enabling it to retrieve pruned blocks from its server's peers.
4d47c37
to
56c5365
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👑
Does this mean that LND will be able to validate channels that were created before the pruned data? |
Yes @mandelmonkey, it'll request pruned data from the bitcoind peers. |
What if the bitcoind peers are also pruned? All of them? (Maybe I am overly paranoid) |
Good question, lnd will currently block on waiting for a full node connection if that's the case. Glancing at bitcoind's source, I didn't find any requirements for having at least N full node connections, so we wouldn't be able to enforce it at that level. It looks like we could use bitcoind's |
Thanks for this useful feature! Is the section https://github.com/lightningnetwork/lnd/blob/master/docs/safety.md#pruned-bitcoind-node still true? |
@mmilata no that needs an update. It's now safe to run a pruned node regardless of how many blocks have been pruned. |
This removes a warning in the documentation saying that pruned nodes are not supported. This is no longer the case as [pruning is supported since 0.13](lightningnetwork#5154). So instead it now says pruning is supported and notes the version and implications of pruning.
@wpaulino Now that Bitcoin RPC supports |
To minimally support lnd deployments connected to pruned nodes, we've extended our bitcoind RPC client with the ability to request blocks that the server has already pruned. This is done by connecting to the server's full node peers and querying them directly. The number of peers we connect to can be set through the new
pruned-node-max-peers
config option; it is configured with a default of 4 at the moment. Ideally, this is a capability supported by the server, though this is not yet possible with bitcoind.Block caching is not done yet, but will be expected to roll out along with this feature as a separate PR to minimize bandwidth consumption.
Note that a lot of the diff is unrelated due to a name change within the updated btcd dependency that caused changes across several files in the codebase.
Depends on btcsuite/btcwallet#737.
Fixes #2997.