diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 7618fa0ac..5388fdb8c 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -573,7 +573,7 @@ static void get_init_blockhash(struct bitcoind *bitcoind, u32 blockcount, /* Rollback to the given blockheight, so we start track * correctly again */ - wallet_blocks_rollback(topo->wallet, topo->first_blocknum - 1); + wallet_blocks_rollback(topo->wallet, topo->first_blocknum); /* Get up to speed with topology. */ bitcoind_getblockhash(bitcoind, topo->first_blocknum, diff --git a/wallet/wallet.c b/wallet/wallet.c index 329f24d00..a66324819 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -2027,7 +2027,7 @@ void wallet_block_remove(struct wallet *w, struct block *b) void wallet_blocks_rollback(struct wallet *w, u32 height) { sqlite3_stmt *stmt = db_prepare(w->db, "DELETE FROM blocks " - "WHERE height >= ?"); + "WHERE height > ?"); sqlite3_bind_int(stmt, 1, height); db_exec_prepared(w->db, stmt); }