mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-04 05:34: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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user