diff options
Diffstat (limited to 'les/api_backend.go')
-rw-r--r-- | les/api_backend.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/les/api_backend.go b/les/api_backend.go index 04120c669..b77767ed7 100644 --- a/les/api_backend.go +++ b/les/api_backend.go @@ -30,6 +30,7 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/internal/ethapi" "github.com/ethereum/go-ethereum/light" + "github.com/ethereum/go-ethereum/params" rpc "github.com/ethereum/go-ethereum/rpc" "golang.org/x/net/context" ) @@ -39,6 +40,14 @@ type LesApiBackend struct { gpo *gasprice.LightPriceOracle } +func (b *LesApiBackend) ChainConfig() *params.ChainConfig { + return b.eth.chainConfig +} + +func (b *LesApiBackend) CurrentBlock() *types.Block { + return types.NewBlockWithHeader(b.eth.BlockChain().CurrentHeader()) +} + func (b *LesApiBackend) SetHead(number uint64) { b.eth.blockchain.SetHead(number) } @@ -81,13 +90,13 @@ func (b *LesApiBackend) GetTd(blockHash common.Hash) *big.Int { func (b *LesApiBackend) GetVMEnv(ctx context.Context, msg core.Message, state ethapi.State, header *types.Header) (vm.Environment, func() error, error) { stateDb := state.(*light.LightState).Copy() - addr, _ := msg.From() + addr := msg.From() from, err := stateDb.GetOrNewStateObject(ctx, addr) if err != nil { return nil, nil, err } from.SetBalance(common.MaxBig) - env := light.NewEnv(ctx, stateDb, b.eth.chainConfig, b.eth.blockchain, msg, header, b.eth.chainConfig.VmConfig) + env := light.NewEnv(ctx, stateDb, b.eth.chainConfig, b.eth.blockchain, msg, header, vm.Config{}) return env, env.Error, nil } |