core-lightning/wallet/test
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
..
.gitignore wallet: move tests into test/ dir like other unit tests. 2017-12-13 22:46:10 +01:00
Makefile wallet: don't use non-common objects as if they were common. 2018-02-07 00:46:49 +00:00
run-db.c db: log a message to say whether we created or updated db. 2018-01-02 13:21:25 +01:00
run-wallet.c wallet: don't use rowid for the channel's DBID. 2018-02-19 02:56:51 +00:00
test_utils.h wallet: move tests into test/ dir like other unit tests. 2017-12-13 22:46:10 +01:00