Skip to content

Commit

Permalink
Add liquidity ads TLVs to RBF messages
Browse files Browse the repository at this point in the history
Every RBF attempts provided the opportunity to modify the liquidity
purchase: we thus must explicitly state whether we're purchasing
liquidity in `tx_init_rbf`.

We also update the TLV tags to prevent a conflict with the released
version of `cln` which already uses those TLVs with an experimental
format. This will make the migration to the new TLVs easier for them
without disrupting existing users.
  • Loading branch information
t-bast committed Oct 10, 2024
1 parent 69aca14 commit 910c070
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
22 changes: 20 additions & 2 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`:
- 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,7 +1181,7 @@ This message initiates the v2 channel establishment workflow.
2. data:
* [`...*byte`:`type`]
1. type: 2 (`require_confirmed_inputs`)
1. type: 3 (`request_funding`)
1. type: 5 (`request_funding`)
2. data:
* [`request_funds`:`request_funds`]

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

Expand Down
2 changes: 1 addition & 1 deletion 07-routing-gossip.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ nodes not associated with an already known channel are ignored.

1. `tlv_stream`: `node_announcement_tlvs`
2. types:
1. type: 1 (`option_will_fund`)
1. type: 5 (`option_will_fund`)
2. data:
* [`will_fund_rates`:`will_fund_rates`]

Expand Down
12 changes: 6 additions & 6 deletions bolt07/liquidity-ads.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
}
}
},
"signature": "22ec2e2a6e02f54d949e332cbce571d123ae20dda98d0340ac7e64f60f11d413659a2a9645adea8f886bb5dd40cc589bd3e0f4f8b2ab333d323b74b7762b4ca1",
"encoded": "0101 22ec2e2a6e02f54d949e332cbce571d123ae20dda98d0340ac7e64f60f11d413659a2a9645adea8f886bb5dd40cc589bd3e0f4f8b2ab333d323b74b7762b4ca1 0000 661cebc9 03ca9b880627d2d4e3b33164f66946349f820d26aa9572fe0e525e534850cbd413 2a7557 4c4e2d4c69717569646974790000000000000000000000000000000000000000 0000 012d0002000186a00007a1200226006400001388000003e80007a120004c4b40044c004b00000000000005dc000101"
"signature": "2e6a9b7017d0c6d8c823f6aa5fcaaea266ea5c7ebc88345efc3ec227e71dee38148371cef4ffaf6d37318de42ded99203e89aaf9f697ad211915dc83dc9cfa63",
"encoded": "0101 2e6a9b7017d0c6d8c823f6aa5fcaaea266ea5c7ebc88345efc3ec227e71dee38148371cef4ffaf6d37318de42ded99203e89aaf9f697ad211915dc83dc9cfa63 0000 661cebc9 03ca9b880627d2d4e3b33164f66946349f820d26aa9572fe0e525e534850cbd413 2a7557 4c4e2d4c69717569646974790000000000000000000000000000000000000000 0000 052d0002000186a00007a1200226006400001388000003e80007a120004c4b40044c004b00000000000005dc000101"
},
"open_channel2": {
"chainHash": "6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000",
Expand Down Expand Up @@ -81,10 +81,10 @@
"type": "from_channel_balance",
"encoded": "0000"
},
"encoded": "03 1e 00000000000b71b0 0007a120004c4b40044c004b00000000000005dc 0000"
"encoded": "05 1e 00000000000b71b0 0007a120004c4b40044c004b00000000000005dc 0000"
}
},
"encoded": "0040 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 0100000000000000000000000000000000000000000000000000000000000000 00001388 00000fa0 000000000003d090 00000000000001f4 000000000000c350 000000000000000f 0090 01e3 0009eb10 031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f 024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766 02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337 03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b 0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7 03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a 02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f 01 031e00000000000b71b00007a120004c4b40044c004b00000000000005dc0000"
"encoded": "0040 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 0100000000000000000000000000000000000000000000000000000000000000 00001388 00000fa0 000000000003d090 00000000000001f4 000000000000c350 000000000000000f 0090 01e3 0009eb10 031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f 024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766 02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337 03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b 0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7 03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a 02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f 01 051e00000000000b71b00007a120004c4b40044c004b00000000000005dc0000"
},
"accept_channel2": {
"temporaryChannelId": "0100000000000000000000000000000000000000000000000000000000000000",
Expand Down Expand Up @@ -114,9 +114,9 @@
},
"funding_script": "00202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103c",
"signature": "c57cf393f6bd534472ec08cbfbbc7268501b32f563a21cdf02a99127c4f25168249acd6509f96b2e93843c3b838ee4808c75d0a15ff71ba886fda980b8ca954f",
"encoded": "03 78 0007a120004c4b40044c004b00000000000005dc 002200202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103c c57cf393f6bd534472ec08cbfbbc7268501b32f563a21cdf02a99127c4f25168249acd6509f96b2e93843c3b838ee4808c75d0a15ff71ba886fda980b8ca954f"
"encoded": "05 78 0007a120004c4b40044c004b00000000000005dc 002200202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103c c57cf393f6bd534472ec08cbfbbc7268501b32f563a21cdf02a99127c4f25168249acd6509f96b2e93843c3b838ee4808c75d0a15ff71ba886fda980b8ca954f"
}
},
"encoded": "0041 0100000000000000000000000000000000000000000000000000000000000000 00000000000aae60 00000000000001d9 0000000005f5e100 0000000000000001 00000006 0090 0032 031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f 024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766 02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337 03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b 0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7 03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a 02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f 03780007a120004c4b40044c004b00000000000005dc002200202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103cc57cf393f6bd534472ec08cbfbbc7268501b32f563a21cdf02a99127c4f25168249acd6509f96b2e93843c3b838ee4808c75d0a15ff71ba886fda980b8ca954f"
"encoded": "0041 0100000000000000000000000000000000000000000000000000000000000000 00000000000aae60 00000000000001d9 0000000005f5e100 0000000000000001 00000006 0090 0032 031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f 024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766 02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337 03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b 0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7 03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a 02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f 05780007a120004c4b40044c004b00000000000005dc002200202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103cc57cf393f6bd534472ec08cbfbbc7268501b32f563a21cdf02a99127c4f25168249acd6509f96b2e93843c3b838ee4808c75d0a15ff71ba886fda980b8ca954f"
}
}

0 comments on commit 910c070

Please sign in to comment.