diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index c71add93bc..29f3fbd5ad 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -158,6 +158,11 @@ func (c *SimulatedBeacon) Stop() error { return nil } +// Oasys: Returns the simulated Ethereum. +func (c *SimulatedBeacon) Ethereum() *eth.Ethereum { + return c.eth +} + // sealBlock initiates payload building for a new block and creates a new block // with the completed payload. func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp uint64) error { diff --git a/ethclient/simulated/backend.go b/ethclient/simulated/backend.go index 65d44b9efa..74d848f767 100644 --- a/ethclient/simulated/backend.go +++ b/ethclient/simulated/backend.go @@ -29,6 +29,7 @@ import ( "github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/ethclient/gethclient" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/params" @@ -62,6 +63,8 @@ type simClient struct { // Backend is a simulated blockchain. You can use it to test your contracts or // other code that interacts with the Ethereum chain. type Backend struct { + gethclient *gethclient.Client // Added by Oasys + node *node.Node beacon *catalyst.SimulatedBeacon client simClient @@ -129,6 +132,8 @@ func newWithNode(stack *node.Node, conf *eth.Config, blockPeriod uint64) (*Backe return nil, err } return &Backend{ + gethclient: gethclient.New(stack.Attach()), // Added by Oasys + node: stack, beacon: beacon, client: simClient{ethclient.NewClient(stack.Attach())}, @@ -190,3 +195,13 @@ func (n *Backend) AdjustTime(adjustment time.Duration) error { func (n *Backend) Client() Client { return n.client } + +// Oasys: GethClient returns a gethclient that accesses the simulated chain. +func (n *Backend) GethClient() *gethclient.Client { + return n.gethclient +} + +// Oasys: Blockchain returns the simulated chain. +func (n *Backend) Blockchain() *core.BlockChain { + return n.beacon.Ethereum().BlockChain() +}