This commit is contained in:
Dave Collins 2013-09-09 15:50:13 -05:00
parent 30f2003301
commit 85553133ce
3 changed files with 10 additions and 12 deletions

View file

@ -200,12 +200,12 @@ func (db *LevelDb) Close() {
func (db *LevelDb) DropAfterBlockBySha(sha *btcwire.ShaHash) (rerr error) { func (db *LevelDb) DropAfterBlockBySha(sha *btcwire.ShaHash) (rerr error) {
db.dbLock.Lock() db.dbLock.Lock()
defer db.dbLock.Unlock() defer db.dbLock.Unlock()
defer func () { defer func() {
if rerr == nil { if rerr == nil {
rerr = db.processBatches() rerr = db.processBatches()
} }
} () }()
startheight := db.nextBlock - 1 startheight := db.nextBlock - 1
@ -256,12 +256,11 @@ func (db *LevelDb) DropAfterBlockBySha(sha *btcwire.ShaHash) (rerr error) {
func (db *LevelDb) InsertBlock(block *btcutil.Block) (height int64, rerr error) { func (db *LevelDb) InsertBlock(block *btcutil.Block) (height int64, rerr error) {
db.dbLock.Lock() db.dbLock.Lock()
defer db.dbLock.Unlock() defer db.dbLock.Unlock()
defer func () { defer func() {
if rerr == nil { if rerr == nil {
rerr = db.processBatches() rerr = db.processBatches()
} }
} () }()
blocksha, err := block.Sha() blocksha, err := block.Sha()
if err != nil { if err != nil {

View file

@ -282,7 +282,6 @@ func testBackout(t *testing.T, mode int) {
} }
} }
var savedblocks []*btcutil.Block var savedblocks []*btcutil.Block
func loadBlocks(t *testing.T, file string) (blocks []*btcutil.Block, err error) { func loadBlocks(t *testing.T, file string) (blocks []*btcutil.Block, err error) {