mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
core, eth: Doc changes
This commit is contained in:
parent
f19241bd45
commit
faafd4296e
2 changed files with 5 additions and 1 deletions
|
|
@ -600,10 +600,13 @@ func GetMipmapBloom(db ethdb.Database, number, level uint64) types.Bloom {
|
||||||
return types.BytesToBloom(bloomDat)
|
return types.BytesToBloom(bloomDat)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PreimageTable returns a Database instance with the key prefix for preimage entries.
|
||||||
func PreimageTable(db ethdb.Database) ethdb.Database {
|
func PreimageTable(db ethdb.Database) ethdb.Database {
|
||||||
return ethdb.NewTable(db, preimagePrefix)
|
return ethdb.NewTable(db, preimagePrefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WritePreimages writes the provided set of preimages to the database. `number` is the
|
||||||
|
// current block number, and is used for debug messages only.
|
||||||
func WritePreimages(db ethdb.Database, number uint64, preimages map[common.Hash][]byte) error {
|
func WritePreimages(db ethdb.Database, number uint64, preimages map[common.Hash][]byte) error {
|
||||||
table := PreimageTable(db)
|
table := PreimageTable(db)
|
||||||
batch := table.NewBatch()
|
batch := table.NewBatch()
|
||||||
|
|
@ -620,7 +623,7 @@ func WritePreimages(db ethdb.Database, number uint64, preimages map[common.Hash]
|
||||||
if err := batch.Write(); err != nil {
|
if err := batch.Write(); err != nil {
|
||||||
return fmt.Errorf("preimage write fail for block %d: %v", number, err)
|
return fmt.Errorf("preimage write fail for block %d: %v", number, err)
|
||||||
}
|
}
|
||||||
glog.V(logger.Error).Infof("%d preimages in block %d, including %d new", len(preimages), number, hitCount)
|
glog.V(logger.Debug).Infof("%d preimages in block %d, including %d new", len(preimages), number, hitCount)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -561,6 +561,7 @@ func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, txHash common.
|
||||||
return nil, errors.New("database inconsistency")
|
return nil, errors.New("database inconsistency")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Preimage is a debug API function that returns the preimage for a sha3 hash, if known.
|
||||||
func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) {
|
func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) {
|
||||||
db := core.PreimageTable(api.eth.ChainDb())
|
db := core.PreimageTable(api.eth.ChainDb())
|
||||||
return db.Get(hash.Bytes())
|
return db.Get(hash.Bytes())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue