channeld: Code to implement splicing

Update the lightningd <-> channeld interface with lots of new commands to needed to facilitate spicing.

Implement the channeld splicing protocol leveraging the interactivetx protocol.

Implement lightningd’s channel_control to support channeld in its splicing efforts.

Changelog-Added: Added the features to enable splicing & resizing of active channels.
This commit is contained in:
Dusty Daemon
2023-07-27 14:37:52 -07:00
committed by Rusty Russell
parent ebd0a3fd69
commit 4628e3ace8
88 changed files with 4560 additions and 644 deletions

View File

@@ -37,6 +37,14 @@ struct amount_sat amount_msat_to_sat_round_down(struct amount_msat msat)
return sat;
}
struct amount_msat amount_msat_to_sat_remainder(struct amount_msat msat)
{
struct amount_msat res;
res.millisatoshis = msat.millisatoshis % MSAT_PER_SAT;
return res;
}
/* Different formatting by amounts: btc, sat and msat */
const char *fmt_amount_msat_btc(const tal_t *ctx,
struct amount_msat msat,
@@ -360,6 +368,27 @@ WARN_UNUSED_RESULT bool amount_sat_scale(struct amount_sat *val,
return true;
}
WARN_UNUSED_RESULT bool amount_msat_add_sat_s64(struct amount_msat *val,
struct amount_msat a,
s64 b)
{
if (b < 0)
return amount_msat_sub_sat(val, a, amount_sat(-b));
else
return amount_msat_add_sat(val, a, amount_sat(b));
}
WARN_UNUSED_RESULT bool amount_sat_add_sat_s64(struct amount_sat *val,
struct amount_sat a,
s64 b)
{
if (b < 0)
return amount_sat_sub(val, a, amount_sat(-b));
else
return amount_sat_add(val, a, amount_sat(b));
}
bool amount_sat_eq(struct amount_sat a, struct amount_sat b)
{
return a.satoshis == b.satoshis;