Commit Graph

16 Commits

Author SHA1 Message Date
Dusty Daemon 4628e3ace8 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.
2023-07-31 21:00:22 +09:30
Rusty Russell b4f0929280 db/bindings: allow db_col_short_channel_id_arr and db_col_node_id_arr on null columns
The other _arr helpers allow this, and we want it for the next patch.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-26 06:55:48 +09:30
Rusty Russell b6d347a6d3 db: add optional column string helper, and make db_col amounts return sat/msat.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-26 06:55:48 +09:30
Rusty Russell 0bcff1e76d db/bindings: now bindings are always in order, remove index.
Simply always bind the next one.  No arithmetic required now!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30
Rusty Russell a1c20bfc87 db: implement BIND_NEXT for autocounting.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30
Rusty Russell b7b3cbc84a db: enforce that bindings be done in order.
This is almost always true already; fix up the few non-standard ones.

This is enforced with an assert, and I ran the entire test suite to
double-check.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-18 14:24:01 +09:30
Rusty Russell 04f485aee0 db: add generic warn/error function.
This avoids the mess where we override db_fatal for teqsts, and keeps it
generic.

Also allows us to get rid of one #if DEVELOPER, and an ugly global for
bookkeeper.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-09 16:49:48 +09:30
Matt Morehouse 45cb2b149c db: avoid calling memcpy on NULL
It is possible for db_column_bytes() to return 0 and for
db_column_blob() to return NULL even when db_column_is_null() returns
false. We need to short circuit in this case.

Detected by UBSan:

  db/bindings.c:479:12: runtime error: null pointer passed as argument 2, which is declared to never be null
  /usr/include/string.h:44:28: note: nonnull attribute specified here

  #0 0x95f117 in db_col_arr_ db/bindings.c:479:2
  #1 0x95ef85 in db_col_channel_type db/bindings.c:459:32
  #2 0x852c03 in wallet_stmt2channel wallet/wallet.c:1483:9
  #3 0x81f396 in wallet_channels_load_active wallet/wallet.c:1749:23
  #4 0x81f03d in wallet_init_channels wallet/wallet.c:1765:9
  #5 0x72f1f9 in load_channels_from_wallet lightningd/peer_control.c:2257:7
  #6 0x672856 in main lightningd/lightningd.c:1121:25
2023-06-05 16:16:21 +02:00
Greg Sanders 2918bbbf36 db_col_tx: report txn hex if transaction pulled is invalid 2023-05-29 14:52:03 +09:30
Greg Sanders eec30b1847 db_col_psbt: convert to PSBTv2 on load from db 2023-05-25 11:36:34 +09:30
Rusty Russell 7acaccfb36 wallet: add channel_type field to db.
This was always the intent, but now we have to reconstruct from the
disparate fields.

This means `option_anchor_outputs` is now redundant.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-10 17:26:47 +09:30
Rusty Russell aae77802ef db_col_optional: wrapper for case where a field is allowed to be NULL.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-03-25 15:28:02 +10:30
Rusty Russell d9e274cee2 db_bind_scid: rename to db_bind_short_channel_id
We used to have a text version, so this was named 'scid'.  Fix it now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-03-25 15:28:02 +10:30
Rusty Russell d7c1325e38 wallet: use scid not string for failchannel (now failscid) in payments table.
And remove the now-unused string-based helper functions.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-22 15:19:46 +02:00
Rusty Russell 33a6b18891 db/bindings: rename db_bind_short_channel_id to db_bind_short_channel_id_str, add db_bind_scid.
Although it's deprecated already (because it stores as string), it's
better to make the name explicit.  And create a new helper which stores as BIGINT.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-22 15:19:46 +02:00
niftynei ce12d2b8a9 database: pull out database code into a new module
We're going to reuse the database controllers for the accounting plugin
2022-03-05 15:03:34 +10:30