mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
core, eth, ethdb, internal: Changes in response to review
This commit is contained in:
parent
764162944a
commit
57935425fd
4 changed files with 7 additions and 5 deletions
|
|
@ -600,12 +600,12 @@ func GetMipmapBloom(db ethdb.Database, number, level uint64) types.Bloom {
|
||||||
return types.BytesToBloom(bloomDat)
|
return types.BytesToBloom(bloomDat)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPreimageTable(db ethdb.Database) ethdb.Database {
|
func PreimageTable(db ethdb.Database) ethdb.Database {
|
||||||
return ethdb.NewDatabaseTable(db, preimagePrefix)
|
return ethdb.NewTable(db, preimagePrefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
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 := GetPreimageTable(db)
|
table := PreimageTable(db)
|
||||||
batch := table.NewBatch()
|
batch := table.NewBatch()
|
||||||
hitCount := 0
|
hitCount := 0
|
||||||
for hash, preimage := range preimages {
|
for hash, preimage := range preimages {
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,7 @@ func (self *StateDB) Logs() []*types.Log {
|
||||||
return logs
|
return logs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddPreimage records a SHA3 preimage seen by the VM.
|
||||||
func (self *StateDB) AddPreimage(hash common.Hash, preimage []byte) {
|
func (self *StateDB) AddPreimage(hash common.Hash, preimage []byte) {
|
||||||
if _, ok := self.preimages[hash]; !ok {
|
if _, ok := self.preimages[hash]; !ok {
|
||||||
self.journal = append(self.journal, addPreimageChange{hash: hash})
|
self.journal = append(self.journal, addPreimageChange{hash: hash})
|
||||||
|
|
@ -213,6 +214,7 @@ func (self *StateDB) AddPreimage(hash common.Hash, preimage []byte) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Preimages returns a list of SHA3 preimages that have been submitted.
|
||||||
func (self *StateDB) Preimages() map[common.Hash][]byte {
|
func (self *StateDB) Preimages() map[common.Hash][]byte {
|
||||||
return self.preimages
|
return self.preimages
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -562,6 +562,6 @@ func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, txHash common.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *PrivateDebugAPI) GetPreimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) {
|
func (api *PrivateDebugAPI) GetPreimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) {
|
||||||
db := core.GetPreimageTable(api.eth.ChainDb())
|
db := core.PreimageTable(api.eth.ChainDb())
|
||||||
return db.Get(hash.Bytes())
|
return db.Get(hash.Bytes())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,7 @@ web3._extend({
|
||||||
}),
|
}),
|
||||||
new web3._extend.Method({
|
new web3._extend.Method({
|
||||||
name: 'getPreimage',
|
name: 'getPreimage',
|
||||||
call: 'debug_getPreimage',
|
call: 'debug_preimage',
|
||||||
params: 1,
|
params: 1,
|
||||||
inputFormatter: [null]
|
inputFormatter: [null]
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue