Merge pull request #37 from mdr0id/reorg_logic1

Use REPLACE on db row creation for initial reorg logic
This commit is contained in:
str4d 2019-05-14 15:08:17 +01:00 committed by GitHub
commit 4794bca46e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -122,7 +122,7 @@ func GetBlockRange(ctx context.Context, db *sql.DB, blockOut chan<- []byte, errO
}
func StoreBlock(conn *sql.DB, height int, hash string, sapling bool, encoded []byte) error {
insertBlock := "INSERT INTO blocks (block_height, block_hash, sapling, compact_encoding) values (?, ?, ?, ?)"
insertBlock := "REPLACE INTO blocks (block_height, block_hash, sapling, compact_encoding) values (?, ?, ?, ?)"
tx, err := conn.Begin()
if err != nil {