Skip to content
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

Reserve greater than dust #1220

Merged

Conversation

rustyrussell
Copy link
Contributor

This is an attempt to implement the lightning/bolts/pull/389 requirements, which should prevent us from ever producing all-dust outputs.

Copy link
Member

@cdecker cdecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far. The first commit also needs to bump the funding amount on the following tests for it to pass CI:

  • test_bech32_funding
  • test_disconnect_fundee
  • test_disconnect_funder
  • test_disconnect_half_signed
  • test_reconnect_openingd
  • test_reconnect_signed
  • test_routing_gossip
  • test_routing_gossip_reconnect

Alternatively we can bump the reserve required to be 2.5x the current value.

* - MUST set `channel_reserve_satoshis` greater than or equal to
* `dust_limit_satoshis`.
*/
if (state->localconf.channel_reserve_satoshis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should probably be extracted into a common function, it's being used twice. Also there is the asymmetry of one calling peer_failed and the other calling status_failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to rework this so we get clearer messages: for the local side we want to say "we refused to offer xxx" or "they offered xxx" and slight language differences for the error message we send to peer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I've switched this to adjust the reserve to meet the minimum.

I also added a patch which make negotiation_failed clearer: it's for use when they give us something we don't agree with, not when we set parameters we can't meet.

Am testing to see what tests this broke...

@cdecker cdecker added this to the v0.6 milestone Mar 16, 2018
@rustyrussell
Copy link
Contributor Author

I wonder if we should just set reserve to 1% or dust limit, whatever is greater.

This quotes from the BOLT proposal at lightning/bolts#389

Don't try to fund channels with reserve less than dust, nor allow them
to fund channels with reserve less than dust.

Fixes: ElementsProject#632
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This quotes from the BOLT proposal at lightning/bolts#389

Don't try to fund channels which would do this, and don't allow others
to fund channels which would do this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is probably covered by our "channel capacity" heuristic which
requires the channel be significant, but best to be explicit and sure.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
'negotiation_failed' is currently just a useless wrapper around
peer_failed (a vestige from when peer_failed would close the
connection).  Change it to send different local and remote messages,
and use it wherever we dislike their parameters: stick with
peer_failed if we dislike our own parameters.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
I saw a failure in test_funding_fail():
	assert l2.rpc.listpeers()['peers'][0]['connected']

This can happen if l2 hasn't yet handed back to gossipd.  Turns out
we didn't mark uncommitted channels as connected:

	[{'id': '03afa3c78bb39217feb8aac308852e6383d59409839c2b91955b2d992421f4a41e', 'connected': False, 'channels': [{'state': 'OPENINGD', 'owner': 'lightning_openingd', 'funder': 'REMOTE', 'status': ['Incoming channel: accepted, now waiting for them to create funding tx']}]}]

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell rustyrussell force-pushed the reserve-greater-than-dust branch from 2222855 to 7682f78 Compare March 18, 2018 23:42
@rustyrussell rustyrussell changed the title WIP: Reserve greater than dust Reserve greater than dust Apr 5, 2018
@rustyrussell
Copy link
Contributor Author

Removed WIP; this is a good change indep. of what happens to spec.

Copy link
Member

@cdecker cdecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 7682f78

@cdecker cdecker merged commit daa14f4 into ElementsProject:master Apr 5, 2018
rustyrussell added a commit to rustyrussell/lightning that referenced this pull request Feb 26, 2025
…ound `channel_announcement` handling (ElementsProject#1220)"

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
rustyrussell added a commit to rustyrussell/lightning that referenced this pull request Mar 4, 2025
…ound `channel_announcement` handling (ElementsProject#1220)"

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
rustyrussell added a commit to rustyrussell/lightning that referenced this pull request Mar 4, 2025
…ound `channel_announcement` handling (ElementsProject#1220)"

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants