Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8838920
splice: test mutli-channel splice script and fees
ddustin Feb 1, 2026
83fce33
amount: Add decimal format for msats
ddustin Aug 16, 2025
13cd921
amount: Can add sat convenience method
ddustin Feb 1, 2026
5867dbf
splice-script: channel id corner case
ddustin Aug 16, 2025
2a89131
splice-script: wetlog / debuglog fix
ddustin Aug 16, 2025
23802b6
splice-script: Memleak fix on failure
ddustin Aug 16, 2025
39d89f8
channeld: Inform channeld about opening feerate
ddustin Aug 16, 2025
1197fa8
channeld: Add new feerate type ‘splice’
ddustin Feb 1, 2026
4df0be0
ld: Expose splice feerate to RPC
ddustin Feb 1, 2026
44583ed
splice: Add and improve logging
ddustin Feb 1, 2026
d2bb6da
splice: Fix weight calculations & use opening feerate
ddustin Feb 1, 2026
9f540cb
splice: Update `tx_abort` for mulitple splices
ddustin Feb 1, 2026
72afb81
splice: Fail earlier on too-few-funds
ddustin Feb 1, 2026
3bb28af
gossip: Don’t reset channel on stale annoncement
ddustin Feb 1, 2026
5f2627c
splice: multi channel stfu bugfix
ddustin Jan 29, 2026
e89f7d1
splice script: Add new PENDING state and log
ddustin Feb 1, 2026
cdae612
splice script: Zero out wallet fund requests
ddustin Feb 1, 2026
93139d2
splice script: Turn “wallet -> *” into “wallet -> 100%”
ddustin Feb 1, 2026
4a18e9d
splice script: Allow `out_ppm` for wallet
ddustin Feb 1, 2026
34a1a50
splice script: Helper functions for dynamic calcs
ddustin Feb 1, 2026
3df2f91
splice script: Switch to splice feerate
ddustin Feb 1, 2026
d642225
splice script: Improve weight guess calculation
ddustin Feb 1, 2026
f581d08
splice script: Implement dynamic wallet & fee
ddustin Feb 1, 2026
68d7569
splice script: Update tests to use dynamic fees
ddustin Feb 1, 2026
f2f95eb
splice: Turn on multi-channel, dynamic wallet, smart fees
ddustin Feb 1, 2026
f89d2f9
fixup! splice: test mutli-channel splice script and fees
ddustin Feb 5, 2026
60212bc
fixup! splice script: Implement dynamic wallet & fee
ddustin Feb 5, 2026
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
10 changes: 10 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -1689,6 +1689,7 @@
"Feerates.perkb.mutual_close": 4,
"Feerates.perkb.opening": 3,
"Feerates.perkb.penalty": 8,
"Feerates.perkb.splice": 12,
"Feerates.perkb.unilateral_anchor_close": 11,
"Feerates.perkb.unilateral_close": 5
},
Expand All @@ -1707,6 +1708,7 @@
"Feerates.perkw.mutual_close": 4,
"Feerates.perkw.opening": 3,
"Feerates.perkw.penalty": 8,
"Feerates.perkw.splice": 12,
"Feerates.perkw.unilateral_anchor_close": 11,
"Feerates.perkw.unilateral_close": 5
},
Expand Down Expand Up @@ -7288,6 +7290,10 @@
"added": "pre-v0.10.1",
"deprecated": null
},
"Feerates.perkb.splice": {
"added": "v26.04",
"deprecated": null
},
"Feerates.perkb.unilateral_anchor_close": {
"added": "v23.08",
"deprecated": null
Expand Down Expand Up @@ -7348,6 +7354,10 @@
"added": "pre-v0.10.1",
"deprecated": null
},
"Feerates.perkw.splice": {
"added": "v26.04",
"deprecated": null
},
"Feerates.perkw.unilateral_anchor_close": {
"added": "v23.08",
"deprecated": null
Expand Down
45 changes: 43 additions & 2 deletions bitcoin/psbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <ccan/ccan/mem/mem.h>
#include <common/utils.h>
#include <wally_psbt.h>
#include <wally_psbt_members.h>
#include <wire/wire.h>


Expand Down Expand Up @@ -480,6 +481,28 @@ void psbt_input_set_witscript(struct wally_psbt *psbt, size_t in, const u8 *wscr
tal_wally_end(psbt);
}

const u8 *psbt_input_get_witscript(const tal_t *ctx,
const struct wally_psbt *psbt,
size_t in)
{
size_t witscript_len, written_len;
u8 *witscript;
if (wally_psbt_get_input_witness_script_len(psbt, in, &witscript_len) != WALLY_OK)
abort();
witscript = tal_arr(ctx, u8, witscript_len);
if (wally_psbt_get_input_witness_script(psbt, in, witscript, witscript_len, &written_len) != WALLY_OK)
abort();
if (witscript_len != written_len)
abort();
return witscript;
}

bool psbt_input_get_ecdsa_sig(const tal_t *ctx,
const struct wally_psbt *psbt,
size_t in,
const struct pubkey *pubkey,
struct bitcoin_signature **sig);

void psbt_elements_input_set_asset(struct wally_psbt *psbt, size_t in,
struct amount_asset *asset)
{
Expand Down Expand Up @@ -592,10 +615,16 @@ struct amount_sat psbt_input_get_amount(const struct wally_psbt *psbt,
}

size_t psbt_input_get_weight(const struct wally_psbt *psbt,
size_t in)
size_t in,
enum PSBT_GUESS guess)
{
size_t weight;
const struct wally_map_item *redeem_script;
struct wally_psbt_input *input = &psbt->inputs[in];
struct wally_tx_output *utxo_out = NULL;

if (input->utxo)
utxo_out = &input->utxo->outputs[input->index];

redeem_script = wally_map_get_integer(&psbt->inputs[in].psbt_fields, /* PSBT_IN_REDEEM_SCRIPT */ 0x04);

Expand All @@ -605,8 +634,20 @@ size_t psbt_input_get_weight(const struct wally_psbt *psbt,
weight +=
(redeem_script->value_len +
varint_size(redeem_script->value_len)) * 4;
} else if ((guess & PSBT_GUESS_2OF2)
&& utxo_out
&& is_p2wsh(utxo_out->script, utxo_out->script_len, NULL)) {
weight = bitcoin_tx_input_weight(false,
bitcoin_tx_2of2_input_witness_weight());
} else if (utxo_out
&& is_p2wpkh(utxo_out->script, utxo_out->script_len, NULL)) {
weight = bitcoin_tx_input_weight(false,
bitcoin_tx_input_witness_weight(UTXO_P2SH_P2WPKH));
} else if (utxo_out
&& is_p2tr(utxo_out->script, utxo_out->script_len, NULL)) {
weight = bitcoin_tx_input_weight(false,
bitcoin_tx_input_witness_weight(UTXO_P2TR));
} else {
/* zero scriptSig length */
weight += varint_size(0) * 4;
}

Expand Down
19 changes: 17 additions & 2 deletions bitcoin/psbt.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ WARN_UNUSED_RESULT bool psbt_input_get_ecdsa_sig(const tal_t *ctx,

void psbt_input_set_witscript(struct wally_psbt *psbt, size_t in, const u8 *wscript);

const u8 *psbt_input_get_witscript(const tal_t *ctx,
const struct wally_psbt *psbt,
size_t in);

/* psbt_input_set_unknown - Set the given Key-Value in the psbt's input keymap
* @ctx - tal context for allocations
* @in - psbt input to set key-value on
Expand Down Expand Up @@ -265,9 +269,20 @@ void psbt_output_set_unknown(const tal_t *ctx,
struct amount_sat psbt_input_get_amount(const struct wally_psbt *psbt,
size_t in);

/* psbt_input_get_weight - Calculate the tx weight for input index `in` */
enum PSBT_GUESS {
PSBT_GUESS_ZERO = 0x0, /* Assume unknown is 0 bytes (fallback) */
PSBT_GUESS_2OF2 = 0x1, /* Assume P2WSH is 2of2 multisig (req prevtx) */
};

/* psbt_input_get_weight - Calculate the tx weight for input index `in`.
*
* @psbt - psbt
* @in - index of input who's weight you want
* @guess - How to guess if we have incomplete information
* */
size_t psbt_input_get_weight(const struct wally_psbt *psbt,
size_t in);
size_t in,
enum PSBT_GUESS guess);

/* psbt_output_get_amount - Returns the value of this output
*
Expand Down
Loading
Loading