Skip to content

Commit 3c137fa

Browse files
rustyrussellShahanaFarooqui
authored andcommitted
lightningd: explicit db arg to wait_index_increase so we can use it in migrations.
Before db is complete, ld->wallet->db is NULL. Signed-off-by: Rusty Russell <[email protected]>
1 parent 719a10b commit 3c137fa

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lightningd/peer_htlcs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3059,7 +3059,8 @@ void htlcs_index_deleted(struct lightningd *ld,
30593059
const struct channel *channel,
30603060
u64 num_deleted)
30613061
{
3062-
wait_index_increase(ld, WAIT_SUBSYSTEM_HTLCS, WAIT_INDEX_DELETED,
3062+
wait_index_increase(ld, ld->wallet->db,
3063+
WAIT_SUBSYSTEM_HTLCS, WAIT_INDEX_DELETED,
30633064
num_deleted,
30643065
"short_channel_id", fmt_short_channel_id(tmpctx, channel_scid_or_local_alias(channel)),
30653066
NULL);

lightningd/wait.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ u64 wait_index_increment(struct lightningd *ld,
189189
}
190190

191191
void wait_index_increase(struct lightningd *ld,
192+
struct db *db,
192193
enum wait_subsystem subsystem,
193194
enum wait_index index,
194195
u64 num,
@@ -200,7 +201,7 @@ void wait_index_increase(struct lightningd *ld,
200201
return;
201202

202203
va_start(ap, num);
203-
wait_index_bump(ld, ld->wallet->db, subsystem, index, num, ap);
204+
wait_index_bump(ld, db, subsystem, index, num, ap);
204205
va_end(ap);
205206
}
206207

lightningd/wait.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ u64 LAST_ARG_NULL wait_index_increment(struct lightningd *ld,
5757
/**
5858
* wait_index_increase - increase an index, tell waiters.
5959
* @ld: the lightningd
60+
* @db: the database (usually ld->wallet->db, except really early)
6061
* @subsystem: subsystem for index
6162
* @index: which index
6263
* @num: number to add (if > 0).
@@ -65,6 +66,7 @@ u64 LAST_ARG_NULL wait_index_increment(struct lightningd *ld,
6566
* A more generic version if wait_index_increment: if num is 0 it's a noop.
6667
*/
6768
void LAST_ARG_NULL wait_index_increase(struct lightningd *ld,
69+
struct db *db,
6870
enum wait_subsystem subsystem,
6971
enum wait_index index,
7072
u64 num,

0 commit comments

Comments
 (0)