This query should be performed as part of the transaction, not outside it.

This commit is contained in:
Dale Rahn 2013-09-11 22:43:08 -04:00
parent 9e27c82a23
commit 1530141ba0

View file

@ -37,7 +37,7 @@ func (db *SqliteDb) insertBlockData(sha *btcwire.ShaHash, prevSha *btcwire.ShaHa
if prevOk := db.blkExistsSha(prevSha); !prevOk { if prevOk := db.blkExistsSha(prevSha); !prevOk {
var numBlocks uint64 var numBlocks uint64
querystr := "SELECT COUNT(blockid) FROM block;" querystr := "SELECT COUNT(blockid) FROM block;"
err := db.sqldb.QueryRow(querystr).Scan(&numBlocks) err := tx.tx.QueryRow(querystr).Scan(&numBlocks)
if err != nil { if err != nil {
return 0, err return 0, err
} }