mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-14 12:06:40 +00:00
update the slotSizeFn method
This commit is contained in:
parent
c13ba75bfb
commit
d959ad18bc
1 changed files with 7 additions and 3 deletions
|
|
@ -41,8 +41,6 @@ type limboBlob struct {
|
||||||
// limbo is a light, indexed database to temporarily store recently included
|
// limbo is a light, indexed database to temporarily store recently included
|
||||||
// blobs until they are finalized. The purpose is to support small reorgs, which
|
// blobs until they are finalized. The purpose is to support small reorgs, which
|
||||||
// would require pulling back up old blobs (which aren't part of the chain).
|
// would require pulling back up old blobs (which aren't part of the chain).
|
||||||
//
|
|
||||||
// TODO(karalabe): Currently updating the inclusion block of a blob needs a full db rewrite. Can we do without?
|
|
||||||
type limbo struct {
|
type limbo struct {
|
||||||
store billy.Database // Persistent data store for limboed blobs
|
store billy.Database // Persistent data store for limboed blobs
|
||||||
index map[common.Hash]*limboBlob // Mappings from tx hashes to datastore ids
|
index map[common.Hash]*limboBlob // Mappings from tx hashes to datastore ids
|
||||||
|
|
@ -60,7 +58,13 @@ func newLimbo(datadir string, maxBlobsPerTransaction int) (*limbo, error) {
|
||||||
fails = append(fails, id)
|
fails = append(fails, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
store, err := billy.Open(billy.Options{Path: datadir, Repair: true}, newSlotter(maxBlobsPerTransaction), index)
|
store, err := billy.Open(billy.Options{Path: datadir, Repair: true}, func() (size uint32, done bool) {
|
||||||
|
// 8*6: Total size of uint64.
|
||||||
|
// 4: The size of uint32.
|
||||||
|
// 32*4: The max total size of big.Int.
|
||||||
|
// 32*(maxBlobsPerTransaction+2): The total size of hashes.
|
||||||
|
return 8*6 + 4 + 32*4 + 32*uint32(maxBlobsPerTransaction+2), true
|
||||||
|
}, index)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue