8000 Extensible Liquidity Ads by t-bast · Pull Request #1153 · lightning/bolts · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Extensible Liquidity Ads #1153

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions 01-messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,18 @@ The `features` field MUST be padded to bytes with 0s.
1. type: 3 (`remote_addr`)
2. data:
* [`...*byte`:`data`]
1. type: 5 (`option_will_fund`)
2. data:
* [`will_fund_rates`:`will_fund_rates`]

The optional `networks` indicates the chains the node is interested in.

The optional `remote_addr` can be used to circumvent NAT issues.

`option_will_fund` allows nodes to announce their willingness to provide funding
to other nodes using one of the included funding rates, as described in the
[liquidity ads section](07-routing-gossip.md#liquidity-ads).

#### Requirements

The sending node:
Expand Down
58 changes: 58 additions & 0 deletions 02-peer-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,9 @@ completed.
2. data:
* [`s64`:`satoshis`]
1. type: 2 (`require_confirmed_inputs`)
1. type: 5 (`request_funding`)
2. data:
* [`request_funds`:`request_funds`]

#### Requirements

Expand All @@ -463,6 +466,12 @@ The sender:
- MUST set `funding_output_contribution`
- If it requires the receiving node to only use confirmed inputs:
- MUST set `require_confirmed_inputs`
- If it wants the receiving node to contribute to the funding transaction
using `option_will_fund`:
- MUST send `request_funding` containing one of the funding rates and
`payment_type`s supported by the receiving node.
- If the previous transaction included `request_funding`:
Copy link
@remyers remyers Jun 5, 2025

Choose a reason for hiding this comment

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

If PR 1236 is merged, and either side can send tx_init_rbf then this line will need some clarification.

Only the initiator of the previous transaction should set request_funding for tx_init_rbf. The non-initiator must only set funding_output_contribution (as mentioned above) if they will provide an output contribution.

Same for the "The recipient" section below; request_funding is only expected by the non-initiator, but funding_output_contribution should be equal to or greater than the previous transaction that included a request_funding.

Note: this should also apply when the previous transaction is a splice.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, that was discussed during spec meetings for #1236: when someone is purchasing liquidity from you, you shouldn't be the one initiating an RBF, because you would then lose this purchase. I'll update the PR to clarify that after splicing and #1236 are added to the BOLTs.

- SHOULD include `request_funding`.

The recipient:
- MUST respond either with `tx_abort` or with `tx_ack_rbf`
Expand All @@ -472,6 +481,8 @@ The recipient:
- MAY send `tx_abort` for any reason
- MUST fail the negotiation if:
- `require_confirmed_inputs` is set but it cannot provide confirmed inputs
- `request_funding` was included in the previous transaction but is not
included in `tx_init_rbf`.

#### Rationale

Expand Down Expand Up @@ -505,6 +516,9 @@ not contributing to the funding output.
2. data:
* [`s64`:`satoshis`]
1. type: 2 (`require_confirmed_inputs`)
1. type: 5 (`provide_funding`)
2. data:
* [`will_fund`:`will_fund`]

#### Requirements

Expand All @@ -513,12 +527,16 @@ The sender:
- MUST set `funding_output_contribution`
- If it requires the receiving node to only use confirmed inputs:
- MUST set `require_confirmed_inputs`
- If the `request_funding` TLV was sent in `tx_init_rbf`:
- MUST apply the same requirements as `accept_channel2`

The recipient:
- MUST respond with `tx_abort` or with a `tx_add_input` message,
restarting the interactive tx collaboration protocol.
- MUST fail the negotiation if:
- `require_confirmed_inputs` is set but it cannot provide confirmed inputs
- MAY fail the negotiation if `provide_funding` does not match what it
expects, similar to the requirements for `accept_channel2`.

#### Rationale

Expand Down Expand Up @@ -1163,6 +1181,9 @@ This message initiates the v2 channel establishment workflow.
2. data:
* [`...*byte`:`type`]
1. type: 2 (`require_confirmed_inputs`)
1. type: 5 (`request_funding`)
2. data:
* [`request_funds`:`request_funds`]

Rationale and Requirements are the same as for [`open_channel`](#the-open_channel-message),
with the following additions.
Expand All @@ -1177,11 +1198,18 @@ The sending node:
- MUST set `funding_feerate_perkw` to the feerate for this transaction
- If it requires the receiving node to only use confirmed inputs:
- MUST set `require_confirmed_inputs`
- If it wants the receiving node to contribute to the funding transaction
using `option_will_fund`:
- MUST send `request_funding` containing one of the funding rates and
`payment_type`s supported by the receiving node.
- MUST set `requested_sats` to the amount of sats it wants to pay for at
the advertised funding rate.

The receiving node:
- MAY fail the negotiation if:
- the `locktime` is unacceptable
- the `funding_feerate_perkw` is unacceptable
- `request_funds.funding_rate` does not match a rate it advertised.
- MUST fail the negotiation if:
- `require_confirmed_inputs` is set but it cannot provide confirmed inputs

Expand Down Expand Up @@ -1250,6 +1278,9 @@ acceptance of the new channel.
2. data:
* [`...*byte`:`type`]
1. type: 2 (`require_confirmed_inputs`)
1. type: 5 (`provide_funding`)
2. data:
* [`will_fund`:`will_fund`]

Rationale and Requirements are the same as listed above,
for [`accept_channel`](#the-accept_channel-message) with the following
Expand All @@ -1262,10 +1293,29 @@ The accepting node:
- MAY respond with a `funding_satoshis` value of zero.
- If it requires the opening node to only use confirmed inputs:
- MUST set `require_confirmed_inputs`
- If the `request_funding` TLV was sent in `open_channel2`:
- If it does not want to contribute funds or to be paid for its
funding contributions:
- SHOULD omit the `provide_funding` TLV.
- Otherwise, if it decides to be paid for its contributions:
- MUST include the `provide_funding` TLV.
- MUST set `funding_satoshis` to a value greater than `0`.
- MAY set `funding_satoshis` less or more than `requested_sats`.

The receiving node:
- MAY fail the negotiation if:
- It sent `request_funding` and `provide_funding` is not set.
- It sent `request_funding` and `provide_funding` is set and:
- `funding_satoshis` is smaller than requested.
- MUST fail the negotiation if:
- `require_confirmed_inputs` is set but it cannot provide confirmed inputs
- `provide_funding` is set but `request_funding` was not sent in `open_channel2`.
- `provide_funding` is set and:
- `will_fund.funding_rate` does not match `request_funds.funding_rate`.
- `will_fund.funding_script` does not match the channel funding script.
- `will_fund.signature` is invalid.
- MUST pay fees for the `option_will_fund` amount using the `payment_type` selected,
as detailed in the [liquidity ads section](07-routing-gossip.md#liquidity-ads).

#### Rationale

Expand All @@ -1278,6 +1328,14 @@ Instead, the channel reserve is fixed at 1% of the total channel balance
rounded down to the nearest whole satoshi or the `dust_limit_satoshis`,
whichever is greater.

If the opener sent `request_funding` in their `open_channel2` message, the
accepter node may choose to contribute funds, but they don't have to.

If the accepter node has run out of available funds, they should either fail
the negotiation or reply with a `funding_satoshis` set to `0` and omit the
`provide_funding` TLV, allowing the opener to decide whether they want to
proceed anyway or fail the negotiation.

### Funding Composition

Funding composition for channel establishment v2 makes use of the
Expand Down
196 changes: 196 additions & 0 deletions 07-routing-gossip.md