-
Notifications
You must be signed in to change notification settings - Fork 902
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
openingd: Allow users to set the enforced reserve for their counterparty (zeroreserve) #5315
Conversation
2c5c6c9
to
e6f87a3
Compare
1cb92f7
to
f71cff3
Compare
d139a7c
to
811db90
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.
OK, generally approve of this, but I think we could replace the dev switches with a generic channel-size check. You can defer that change until next release if you want though?
We should mention the ability to zeroreserve in the Changelog, if not explicitly called already (I didn't see it, but then GH doesn't exactly highlight commit msgs!)
4a8f4eb
to
25914c2
Compare
6788f83
to
8ac3eb7
Compare
315813e
to
561ccc9
Compare
Changelog-Added: JSON-RPC: `fundchannel`, `multifundchannel` and `fundchannel_start` now accept a `reserve` parameter to indicate the absolute reserve to impose on the peer.
Changelog-Added: plugin: The `openchannel` hook may return a custom absolute `reserve` value that the peer must not dip below.
In the case of the local channel we set the estimation to the exact value spendable, which is important when we want to drain a channel, because there we actually want to get the last msat.
This is incompatible with the spec as it removes the enforcement for reserves being above dust, but from what I can see from other implementations it seems that others have allowed this as well. This commit just guards the necessary changes with compilation guards, so we can decide either way quickly. This part of the PR is not intended to be final, just as a discussion basis.
Technically this is a non-conformance with the spec, hence the `dev` flag to opt-in, however I'm being told that it is also implemented in other implementations. I'll follow this up with a proposal to the spec to remove the checks we now bypass.
This check, while in line with the specification, would cause issues in mixed setups when the funder or fundee allows dust reserves, but the counterparty does not. It is not an issue for the non-dust reserve node since in this case it's the peer giving us more flexibility not the other way around.
Technically this is a non-conformance with the spec, hence the `dev` flag to opt-in, however I'm being told that it is also implemented in other implementations. I'll follow this up with a proposal to the spec to remove the checks we now bypass.
Tests that we can have zeroreserve nodes accept and open new channels with non-zeroreserve nodes, without throwing errors
It means we consume the channel completely to the best of our knowledge, so let that through. Changelog-Fixed: pay: Squeezed out the last `msat` from our local view of the network
This just shows we need to add that constraint. Reported-by: Rusty Russell <@rustyrussell>
The scale variants weren't usable since they use `double` as a scale factor, which in turn causes imprecisions.
Prior to this we might end up with a commitment transaction without any outputs, if combined with `--dev-allowdustreserve`. Otherwise the reserve being larger than dust means the funder could not drop its direct output to be below dust. Reported-by: Rusty Russell <@rustyrussell>
561ccc9
to
afed054
Compare
ACK afed054 |
Based on top of #5275, this PR starts at commit f7d0827
Until now we always applied the default reserve of 1% of the funding amount, however there has been considerable demand to being able to adjust these values. In particular zeroreserve, i.e., not enforcing any minimal amount in the channel from the counterparty, has been an often requested feature. This PR implements the zeroreserve proposal, in two variants (see second to last commit):
The implementation itself is done via a new
reserve
argument to the single funding RPC commands, and by adding a newreserve
return argument to theopenchannel
hook. The values are absolute satoshi values, not percentages.Using arguments and hooks allows the caller or a plugin to selectively opt into allowing the counterparty to drain the channel, based on the nodeid, amount or any other information in the
openchannel
hook (potentially including dynamic lookups). I think this is the best way to allow users to selectively opt-in without them automatically allowing everybody.Either way a stern warning about the trust involved should be added to the docs.
Open questions