Skip to content

Commit 910c070

Browse files
committed
Add liquidity ads TLVs to RBF messages
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.
1 parent 69aca14 commit 910c070

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

02-peer-protocol.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ completed.
453453
2. data:
454454
* [`s64`:`satoshis`]
455455
1. type: 2 (`require_confirmed_inputs`)
456+
1. type: 5 (`request_funding`)
457+
2. data:
458+
* [`request_funds`:`request_funds`]
456459

457460
#### Requirements
458461

@@ -463,6 +466,12 @@ The sender:
463466
- MUST set `funding_output_contribution`
464467
- If it requires the receiving node to only use confirmed inputs:
465468
- MUST set `require_confirmed_inputs`
469+
- If it wants the receiving node to contribute to the funding transaction
470+
using `option_will_fund`:
471+
- MUST send `request_funding` containing one of the funding rates and
472+
`payment_type`s supported by the receiving node.
473+
- If the previous transaction included `request_funding`:
474+
- SHOULD include `request_funding`.
466475

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

476487
#### Rationale
477488

@@ -505,6 +516,9 @@ not contributing to the funding output.
505516
2. data:
506517
* [`s64`:`satoshis`]
507518
1. type: 2 (`require_confirmed_inputs`)
519+
1. type: 5 (`provide_funding`)
520+
2. data:
521+
* [`will_fund`:`will_fund`]
508522

509523
#### Requirements
510524

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

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

523541
#### Rationale
524542

@@ -1163,7 +1181,7 @@ This message initiates the v2 channel establishment workflow.
11631181
2. data:
11641182
* [`...*byte`:`type`]
11651183
1. type: 2 (`require_confirmed_inputs`)
1166-
1. type: 3 (`request_funding`)
1184+
1. type: 5 (`request_funding`)
11671185
2. data:
11681186
* [`request_funds`:`request_funds`]
11691187

@@ -1260,7 +1278,7 @@ acceptance of the new channel.
12601278
2. data:
12611279
* [`...*byte`:`type`]
12621280
1. type: 2 (`require_confirmed_inputs`)
1263-
1. type: 3 (`provide_funding`)
1281+
1. type: 5 (`provide_funding`)
12641282
2. data:
12651283
* [`will_fund`:`will_fund`]
12661284

07-routing-gossip.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ nodes not associated with an already known channel are ignored.
274274

275275
1. `tlv_stream`: `node_announcement_tlvs`
276276
2. types:
277-
1. type: 1 (`option_will_fund`)
277+
1. type: 5 (`option_will_fund`)
278278
2. data:
279279
* [`will_fund_rates`:`will_fund_rates`]
280280

bolt07/liquidity-ads.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
}
4242
}
4343
},
44-
"signature": "22ec2e2a6e02f54d949e332cbce571d123ae20dda98d0340ac7e64f60f11d413659a2a9645adea8f886bb5dd40cc589bd3e0f4f8b2ab333d323b74b7762b4ca1",
45-
"encoded": "0101 22ec2e2a6e02f54d949e332cbce571d123ae20dda98d0340ac7e64f60f11d413659a2a9645adea8f886bb5dd40cc589bd3e0f4f8b2ab333d323b74b7762b4ca1 0000 661cebc9 03ca9b880627d2d4e3b33164f66946349f820d26aa9572fe0e525e534850cbd413 2a7557 4c4e2d4c69717569646974790000000000000000000000000000000000000000 0000 012d0002000186a00007a1200226006400001388000003e80007a120004c4b40044c004b00000000000005dc000101"
44+
"signature": "2e6a9b7017d0c6d8c823f6aa5fcaaea266ea5c7ebc88345efc3ec227e71dee38148371cef4ffaf6d37318de42ded99203e89aaf9f697ad211915dc83dc9cfa63",
45+
"encoded": "0101 2e6a9b7017d0c6d8c823f6aa5fcaaea266ea5c7ebc88345efc3ec227e71dee38148371cef4ffaf6d37318de42ded99203e89aaf9f697ad211915dc83dc9cfa63 0000 661cebc9 03ca9b880627d2d4e3b33164f66946349f820d26aa9572fe0e525e534850cbd413 2a7557 4c4e2d4c69717569646974790000000000000000000000000000000000000000 0000 052d0002000186a00007a1200226006400001388000003e80007a120004c4b40044c004b00000000000005dc000101"
4646
},
4747
"open_channel2": {
4848
"chainHash": "6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000",
@@ -81,10 +81,10 @@
8181
"type": "from_channel_balance",
8282
"encoded": "0000"
8383
},
84-
"encoded": "03 1e 00000000000b71b0 0007a120004c4b40044c004b00000000000005dc 0000"
84+
"encoded": "05 1e 00000000000b71b0 0007a120004c4b40044c004b00000000000005dc 0000"
8585
}
8686
},
87-
"encoded": "0040 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 0100000000000000000000000000000000000000000000000000000000000000 00001388 00000fa0 000000000003d090 00000000000001f4 000000000000c350 000000000000000f 0090 01e3 0009eb10 031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f 024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766 02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337 03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b 0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7 03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a 02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f 01 031e00000000000b71b00007a120004c4b40044c004b00000000000005dc0000"
87+
"encoded": "0040 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 0100000000000000000000000000000000000000000000000000000000000000 00001388 00000fa0 000000000003d090 00000000000001f4 000000000000c350 000000000000000f 0090 01e3 0009eb10 031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f 024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766 02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337 03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b 0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7 03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a 02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f 01 051e00000000000b71b00007a120004c4b40044c004b00000000000005dc0000"
8888
},
8989
"accept_channel2": {
9090
"temporaryChannelId": "0100000000000000000000000000000000000000000000000000000000000000",
@@ -114,9 +114,9 @@
114114
},
115115
"funding_script": "00202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103c",
116116
"signature": "c57cf393f6bd534472ec08cbfbbc7268501b32f563a21cdf02a99127c4f25168249acd6509f96b2e93843c3b838ee4808c75d0a15ff71ba886fda980b8ca954f",
117-
"encoded": "03 78 0007a120004c4b40044c004b00000000000005dc 002200202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103c c57cf393f6bd534472ec08cbfbbc7268501b32f563a21cdf02a99127c4f25168249acd6509f96b2e93843c3b838ee4808c75d0a15ff71ba886fda980b8ca954f"
117+
"encoded": "05 78 0007a120004c4b40044c004b00000000000005dc 002200202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103c c57cf393f6bd534472ec08cbfbbc7268501b32f563a21cdf02a99127c4f25168249acd6509f96b2e93843c3b838ee4808c75d0a15ff71ba886fda980b8ca954f"
118118
}
119119
},
120-
"encoded": "0041 0100000000000000000000000000000000000000000000000000000000000000 00000000000aae60 00000000000001d9 0000000005f5e100 0000000000000001 00000006 0090 0032 031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f 024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766 02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337 03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b 0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7 03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a 02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f 03780007a120004c4b40044c004b00000000000005dc002200202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103cc57cf393f6bd534472ec08cbfbbc7268501b32f563a21cdf02a99127c4f25168249acd6509f96b2e93843c3b838ee4808c75d0a15ff71ba886fda980b8ca954f"
120+
"encoded": "0041 0100000000000000000000000000000000000000000000000000000000000000 00000000000aae60 00000000000001d9 0000000005f5e100 0000000000000001 00000006 0090 0032 031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f 024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766 02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337 03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b 0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7 03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a 02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f 05780007a120004c4b40044c004b00000000000005dc002200202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103cc57cf393f6bd534472ec08cbfbbc7268501b32f563a21cdf02a99127c4f25168249acd6509f96b2e93843c3b838ee4808c75d0a15ff71ba886fda980b8ca954f"
121121
}
122122
}

0 commit comments

Comments
 (0)