aboutsummaryrefslogtreecommitdiffstats
path: root/internal
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 /internal
parent5463ed99968bf71685a2a8ee9dbf8705912f00cb (diff)
downloaddexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar
dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.gz
dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.bz2
dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.lz
dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.xz
dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.zst
dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.zip
core/rawdb: separate raw database access to own package (#16666)
Diffstat (limited to 'internal')
-rw-r--r--internal/ethapi/api.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index e2bfbaf30..a524dbadd 100644
--- a/internal/ethapi/api.go
+++ b/internal/ethapi/api.go
@@ -33,6 +33,7 @@ import (
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
@@ -1006,7 +1007,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, addr
// GetTransactionByHash returns the transaction for the given hash
func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) *RPCTransaction {
// Try to return an already finalized transaction
- if tx, blockHash, blockNumber, index := core.GetTransaction(s.b.ChainDb(), hash); tx != nil {
+ if tx, blockHash, blockNumber, index := rawdb.ReadTransaction(s.b.ChainDb(), hash); tx != nil {
return newRPCTransaction(tx, blockHash, blockNumber, index)
}
// No finalized transaction, try to retrieve it from the pool
@@ -1022,7 +1023,7 @@ func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context,
var tx *types.Transaction
// Retrieve a finalized transaction, or a pooled otherwise
- if tx, _, _, _ = core.GetTransaction(s.b.ChainDb(), hash); tx == nil {
+ if tx, _, _, _ = rawdb.ReadTransaction(s.b.ChainDb(), hash); tx == nil {
if tx = s.b.GetPoolTransaction(hash); tx == nil {
// Transaction not found anywhere, abort
return nil, nil
@@ -1034,7 +1035,7 @@ func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context,
// GetTransactionReceipt returns the transaction receipt for the given transaction hash.
func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error) {
- tx, blockHash, blockNumber, index := core.GetTransaction(s.b.ChainDb(), hash)
+ tx, blockHash, blockNumber, index := rawdb.ReadTransaction(s.b.ChainDb(), hash)
if tx == nil {
return nil, nil
}