Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain [
return 0, err
}
bytes += batch.ValueSize()
batch = bc.chainDb.NewBatch()
batch.Reset()
}
}
if batch.ValueSize() > 0 {
Expand Down
8 changes: 8 additions & 0 deletions ethdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ func (b *ldbBatch) ValueSize() int {
return b.size
}

func (b *ldbBatch) Reset() {
b.b.Reset()
}

type table struct {
db Database
prefix string
Expand Down Expand Up @@ -358,3 +362,7 @@ func (tb *tableBatch) Write() error {
func (tb *tableBatch) ValueSize() int {
return tb.batch.ValueSize()
}

func (tb *tableBatch) Reset() {
tb.batch.Reset()
}
2 changes: 2 additions & 0 deletions ethdb/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ type Batch interface {
Putter
ValueSize() int // amount of data in the batch
Write() error
// Reset resets the batch for reuse
Reset()
}
5 changes: 5 additions & 0 deletions ethdb/memory_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,8 @@ func (b *memBatch) Write() error {
func (b *memBatch) ValueSize() int {
return b.size
}

func (b *memBatch) Reset() {
b.writes = b.writes[:0]
b.size = 0
}

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,10 @@
"revisionTime": "2017-07-05T02:17:15Z"
},
{
"checksumSHA1": "yHbyLpI/Meh0DGrmi8x6FrDxxUY=",
"checksumSHA1": "rpu5ZHjXlV13UKA7L1d5MTOyQwA=",
"path": "github.com/syndtr/goleveldb/leveldb",
"revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
"revisionTime": "2017-07-25T06:48:36Z"
"revision": "211f780988068502fe874c44dae530528ebd840f",
"revisionTime": "2018-01-28T14:04:16Z"
},
{
"checksumSHA1": "EKIow7XkgNdWvR/982ffIZxKG8Y=",
Expand Down