core-lightning/wallet
Rusty Russell 72108f0cb9 wallet: don't use rowid for the channel's DBID.
We derive the seed from this, so it needs to be unique, but using
rowid forced us to put the channel into the db early, before it
was ready.

Instead, use a counter to ensure uniqueness, initialized when we load
existing peers.  This doesn't need to touch the database at all.

As we now have only two places where the channel is committed (the
funder and fundee paths), so we create a new explicit
'wallet_channel_insert()' function: 'wallet_channel_save()' now just
updates.

Note that this also fixes some weirdness in
wallet_channels_load_active: we strangely avoided loading channels in
CLOSINGD_COMPLETE (which fortunately was a transient state, so
unlikely anyone hit this).  Note that since the lines above already
delete all the OPENINGD channels, we now simply load them all.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-19 02:56:51 +00:00
..
test wallet: don't use rowid for the channel's DBID. 2018-02-19 02:56:51 +00:00
.gitignore wallet: Create and manage a sqlite3 database for the wallet 2017-06-06 09:16:10 +09:30
db.c Rename (almost) all destructors to destroy_<type>. 2018-02-14 11:31:58 +01:00
db.h pay: Save nodes and channels used on route to payment. 2018-02-01 00:46:06 +00:00
invoices.c Rename (almost) all destructors to destroy_<type>. 2018-02-14 11:31:58 +01:00
invoices.h invoices: Add expiration timer system. 2018-02-05 08:52:42 +00:00
Makefile invoices: Extensive reorganization of invoice system. 2018-01-16 13:03:54 +01:00
wallet.c wallet: don't use rowid for the channel's DBID. 2018-02-19 02:56:51 +00:00
wallet.h wallet: don't use rowid for the channel's DBID. 2018-02-19 02:56:51 +00:00
walletrpc.c Add dev-listaddrs option (#1001) 2018-02-18 13:52:46 +01:00
walletrpc.h walletrpc: Implemented the withdrawal flow 2017-06-23 16:02:20 +09:30