aboutsummaryrefslogtreecommitdiffstats
path: root/eth/api_backend.go
diff options
context:
space:
mode:
authorFelföldi Zsolt <zsfelfoldi@gmail.com>2019-05-13 19:41:10 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-05-13 19:41:10 +0800
commit40cdcf8c47ff094775aca08fd5d94051f9cf1dbb (patch)
tree3a9fc715ec501ab0fec8c81004e17477bd136f9f /eth/api_backend.go
parentf4fb1a18015d88aa7b424709aac346da59edf410 (diff)
downloadgo-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar
go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar.gz
go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar.bz2
go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar.lz
go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar.xz
go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.tar.zst
go-tangerine-40cdcf8c47ff094775aca08fd5d94051f9cf1dbb.zip
les, light: implement ODR transaction lookup by hash (#19069)
* les, light: implement ODR transaction lookup by hash * les: delete useless file * internal/ethapi: always use backend to find transaction * les, eth, internal/ethapi: renamed GetCanonicalTransaction to GetTransaction * light: add canonical header verification to GetTransaction
Diffstat (limited to 'eth/api_backend.go')
-rw-r--r--eth/api_backend.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/eth/api_backend.go b/eth/api_backend.go
index 9ac06ffa4..db0e8cf41 100644
--- a/eth/api_backend.go
+++ b/eth/api_backend.go
@@ -26,6 +26,7 @@ import (
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/bloombits"
+ "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/core/vm"
@@ -178,6 +179,11 @@ func (b *EthAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction
return b.eth.txPool.Get(hash)
}
+func (b *EthAPIBackend) GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error) {
+ tx, blockHash, blockNumber, index := rawdb.ReadTransaction(b.eth.ChainDb(), txHash)
+ return tx, blockHash, blockNumber, index, nil
+}
+
func (b *EthAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) {
return b.eth.txPool.State().GetNonce(addr), nil
}