mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-20 13:54:36 +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:
parent
541472b77c
commit
d478dc0e59
2 changed files with 7 additions and 1 deletions
2
Makefile
2
Makefile
|
@ -49,7 +49,7 @@ endif
|
|||
|
||||
ifeq ($(COMPAT),1)
|
||||
# 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
|
||||
|
||||
# Timeout shortly before the 600 second travis silence timeout
|
||||
|
|
|
@ -1831,6 +1831,12 @@ static bool wallet_stmt2htlc_in(struct channel *channel,
|
|||
#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);
|
||||
|
||||
return ok;
|
||||
|
|
Loading…
Add table
Reference in a new issue