diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 7b38a58fa..c4d58175a 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -1880,6 +1880,7 @@ static void listforwardings_add_forwardings(struct json_result *response, struct for (size_t i=0; ichannel_in); json_add_short_channel_id(response, "out_channel", &cur->channel_out); json_add_num(response, "in_msatoshi", cur->msatoshi_in); diff --git a/wallet/wallet.c b/wallet/wallet.c index 7a9517cd8..a33514bcc 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -2481,9 +2481,16 @@ const struct forwarding *wallet_forwarded_payments_get(struct wallet *w, cur->msatoshi_in = sqlite3_column_int64(stmt, 1); cur->msatoshi_out = sqlite3_column_int64(stmt, 2); cur->fee = cur->msatoshi_in - cur->msatoshi_out; - sqlite3_column_sha256_double(stmt, 3, &cur->payment_hash); - sqlite3_column_short_channel_id(stmt, 4, &cur->channel_in); - sqlite3_column_short_channel_id(stmt, 5, &cur->channel_out); + + if (sqlite3_column_type(stmt, 3) != SQLITE_NULL) { + cur->payment_hash = tal(ctx, struct sha256_double); + sqlite3_column_sha256_double(stmt, 3, cur->payment_hash); + } else { + cur->payment_hash = NULL; + } + + cur->channel_in.u64 = sqlite3_column_int64(stmt, 4); + cur->channel_out.u64 = sqlite3_column_int64(stmt, 5); } db_stmt_done(stmt); diff --git a/wallet/wallet.h b/wallet/wallet.h index 46187276a..730ef2ec5 100644 --- a/wallet/wallet.h +++ b/wallet/wallet.h @@ -162,7 +162,7 @@ static inline const char* forward_status_name(enum forward_status status) struct forwarding { struct short_channel_id channel_in, channel_out; u64 msatoshi_in, msatoshi_out, fee; - struct sha256_double payment_hash; + struct sha256_double *payment_hash; enum forward_status status; };