aboutsummaryrefslogtreecommitdiffstats
path: root/eth/api.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-05-07 19:35:06 +0800
committerGitHub <noreply@github.com>2018-05-07 19:35:06 +0800
commit6cf0ab38bd0af77d81aad4c104979cebee9e3e63 (patch)
tree142d6f965c44dcf9e2182da67b7bbc978c573448 /eth/api.go
parent5463ed99968bf71685a2a8ee9dbf8705912f00cb (diff)
downloadgo-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar
go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.gz
go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.bz2
go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.lz
go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.xz
go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.zst
go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.zip
core/rawdb: separate raw database access to own package (#16666)
Diffstat (limited to 'eth/api.go')
-rw-r--r--eth/api.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/eth/api.go b/eth/api.go
index a345b57e4..247ca7485 100644
--- a/eth/api.go
+++ b/eth/api.go
@@ -19,6 +19,7 @@ package eth
import (
"compress/gzip"
"context"
+ "errors"
"fmt"
"io"
"math/big"
@@ -28,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
@@ -343,8 +345,10 @@ func NewPrivateDebugAPI(config *params.ChainConfig, eth *Ethereum) *PrivateDebug
// 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) {
- db := core.PreimageTable(api.eth.ChainDb())
- return db.Get(hash.Bytes())
+ if preimage := rawdb.ReadPreimage(api.eth.ChainDb(), hash); preimage != nil {
+ return preimage, nil
+ }
+ return nil, errors.New("unknown preimage")
}
// GetBadBLocks returns a list of the last 'bad blocks' that the client has seen on the network