From 3cd59d52c55be6771488e89f48417c055d07ef87 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 22 Jun 2023 15:29:18 +0800 Subject: [PATCH] Backend: add GetContractCode --- plugins/wrappers/backendwrapper/backendwrapper.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/wrappers/backendwrapper/backendwrapper.go b/plugins/wrappers/backendwrapper/backendwrapper.go index c2421ddc9..cacb5685d 100644 --- a/plugins/wrappers/backendwrapper/backendwrapper.go +++ b/plugins/wrappers/backendwrapper/backendwrapper.go @@ -11,8 +11,9 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" gcore "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/internal/ethapi" "github.com/ethereum/go-ethereum/log" @@ -487,7 +488,6 @@ func (b *Backend) GetAccountTrie(stateRoot core.Hash, account core.Address) (cor return NewWrappedTrie(acTr), nil } - - - - +func (b *Backend) GetContractCode(h core.Hash) ([]byte, error) { + return state.NewDatabase(b.b.ChainDb()).ContractCode(common.Hash{}, common.Hash(h)) +}