mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-18 05:14:22 +01:00
wallet: fix null column access for pre-0.7.3 dbs.
Added in d901304120, this column is null in old dbs like mine:
2020-02-15T00:08:41.444Z **BROKEN** database: Accessing a null column 12 in query SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time FROM channel_htlcs WHERE direction= ? AND channel_id= ? AND hstate != ?
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
2
Makefile
2
Makefile
@@ -49,7 +49,7 @@ endif
|
|||||||
|
|
||||||
ifeq ($(COMPAT),1)
|
ifeq ($(COMPAT),1)
|
||||||
# We support compatibility with pre-0.6.
|
# We support compatibility with pre-0.6.
|
||||||
COMPAT_CFLAGS=-DCOMPAT_V052=1 -DCOMPAT_V060=1 -DCOMPAT_V061=1 -DCOMPAT_V062=1 -DCOMPAT_V070=1 -DCOMPAT_V073=1 -DCOMPAT_V080=1
|
COMPAT_CFLAGS=-DCOMPAT_V052=1 -DCOMPAT_V060=1 -DCOMPAT_V061=1 -DCOMPAT_V062=1 -DCOMPAT_V070=1 -DCOMPAT_V072=1 -DCOMPAT_V073=1 -DCOMPAT_V080=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Timeout shortly before the 600 second travis silence timeout
|
# Timeout shortly before the 600 second travis silence timeout
|
||||||
|
|||||||
@@ -1831,6 +1831,12 @@ static bool wallet_stmt2htlc_in(struct channel *channel,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef COMPAT_V072
|
||||||
|
if (db_column_is_null(stmt, 12)) {
|
||||||
|
in->received_time.ts.tv_sec = 0;
|
||||||
|
in->received_time.ts.tv_nsec = 0;
|
||||||
|
} else
|
||||||
|
#endif /* COMPAT_V072 */
|
||||||
in->received_time = db_column_timeabs(stmt, 12);
|
in->received_time = db_column_timeabs(stmt, 12);
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
|||||||
Reference in New Issue
Block a user