From 661950e4020bbf700cf653226aa7ad9c4680712a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 25 Jan 2018 21:33:50 +1030 Subject: [PATCH] wallet: fix logic for finding first block. Over 20 years a professional C programmer, still can't count from zero! Fixes: #709 Signed-off-by: Rusty Russell --- wallet/wallet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wallet/wallet.c b/wallet/wallet.c index 02c0f326c..2061fe90a 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -632,8 +632,8 @@ u32 wallet_channels_first_blocknum(struct wallet *w) OPENINGD, CLOSINGD_COMPLETE); err = sqlite3_step(stmt); - if (err == SQLITE_ROW && sqlite3_column_type(stmt, 1) != SQLITE_NULL) - first_blocknum = sqlite3_column_int(stmt, 1); + if (err == SQLITE_ROW && sqlite3_column_type(stmt, 0) != SQLITE_NULL) + first_blocknum = sqlite3_column_int(stmt, 0); else first_blocknum = UINT32_MAX;