Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6f5b03f
splice: test mutli-channel splice script and fees
ddustin Feb 1, 2026
a4ae6e9
amount: Add decimal format for msats
ddustin Aug 16, 2025
60f660a
amount: Can add sat convenience method
ddustin Feb 1, 2026
acb387b
splice-script: channel id corner case
ddustin Aug 16, 2025
4883a13
splice-script: wetlog / debuglog fix
ddustin Aug 16, 2025
2c70c05
splice-script: Memleak fix on failure
ddustin Aug 16, 2025
8bfb4a2
channeld: Inform channeld about opening feerate
ddustin Aug 16, 2025
8a8774c
channeld: Add new feerate type ‘splice’
ddustin Feb 1, 2026
85bd1a5
ld: Expose splice feerate to RPC
ddustin Feb 1, 2026
409766a
splice: Add and improve logging
ddustin Feb 1, 2026
c8f2654
splice: Fix weight calculations & use opening feerate
ddustin Feb 1, 2026
9206270
splice: Update `tx_abort` for mulitple splices
ddustin Feb 1, 2026
4035418
splice: Fail earlier on too-few-funds
ddustin Feb 1, 2026
c2ced15
gossip: Don’t reset channel on stale annoncement
ddustin Feb 1, 2026
26f9490
splice: multi channel stfu bugfix
ddustin Jan 29, 2026
a65aa22
splice script: Add new PENDING state and log
ddustin Feb 1, 2026
551d012
splice script: Zero out wallet fund requests
ddustin Feb 1, 2026
df8b4f4
splice script: Turn “wallet -> *” into “wallet -> 100%”
ddustin Feb 1, 2026
12a6e0c
splice script: Allow `out_ppm` for wallet
ddustin Feb 1, 2026
5e8cb31
splice script: Helper functions for dynamic calcs
ddustin Feb 1, 2026
c68c942
splice script: Switch to splice feerate
ddustin Feb 1, 2026
1c498ce
splice script: Improve weight guess calculation
ddustin Feb 1, 2026
5947ba4
splice script: Implement dynamic wallet & fee
ddustin Feb 1, 2026
e45f52c
splice script: Update tests to use dynamic fees
ddustin Feb 1, 2026
1e08ddb
splice: Turn on multi-channel, dynamic wallet, smart fees
ddustin Feb 1, 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