diff options
author | zsfelfoldi <zsfelfoldi@gmail.com> | 2015-12-16 11:26:23 +0800 |
---|---|---|
committer | zsfelfoldi <zsfelfoldi@gmail.com> | 2016-06-16 23:36:38 +0800 |
commit | 3a97280ae889bb6852ba16e70750a37b2ed08473 (patch) | |
tree | 41e078895ddd76fe81b323539046b7d9df8b17b3 /accounts/abi/bind/backends/simulated.go | |
parent | a38be3eb488a349693a9c9905ab015278281f8db (diff) | |
download | go-tangerine-3a97280ae889bb6852ba16e70750a37b2ed08473.tar go-tangerine-3a97280ae889bb6852ba16e70750a37b2ed08473.tar.gz go-tangerine-3a97280ae889bb6852ba16e70750a37b2ed08473.tar.bz2 go-tangerine-3a97280ae889bb6852ba16e70750a37b2ed08473.tar.lz go-tangerine-3a97280ae889bb6852ba16e70750a37b2ed08473.tar.xz go-tangerine-3a97280ae889bb6852ba16e70750a37b2ed08473.tar.zst go-tangerine-3a97280ae889bb6852ba16e70750a37b2ed08473.zip |
eth: separate common and full node-specific API and backend service
Diffstat (limited to 'accounts/abi/bind/backends/simulated.go')
-rw-r--r-- | accounts/abi/bind/backends/simulated.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 54b1ce603..490da82a6 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -27,6 +27,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" + "golang.org/x/net/context" ) // Default chain configuration which sets homestead phase at block 0 (i.e. no frontier) @@ -80,7 +81,7 @@ func (b *SimulatedBackend) Rollback() { // HasCode implements ContractVerifier.HasCode, checking whether there is any // code associated with a certain account in the blockchain. -func (b *SimulatedBackend) HasCode(contract common.Address, pending bool) (bool, error) { +func (b *SimulatedBackend) HasCode(ctx context.Context, contract common.Address, pending bool) (bool, error) { if pending { return len(b.pendingState.GetCode(contract)) > 0, nil } @@ -90,7 +91,7 @@ func (b *SimulatedBackend) HasCode(contract common.Address, pending bool) (bool, // ContractCall implements ContractCaller.ContractCall, executing the specified // contract with the given input data. -func (b *SimulatedBackend) ContractCall(contract common.Address, data []byte, pending bool) ([]byte, error) { +func (b *SimulatedBackend) ContractCall(ctx context.Context, contract common.Address, data []byte, pending bool) ([]byte, error) { // Create a copy of the current state db to screw around with var ( block *types.Block @@ -129,20 +130,20 @@ func (b *SimulatedBackend) ContractCall(contract common.Address, data []byte, pe // PendingAccountNonce implements ContractTransactor.PendingAccountNonce, retrieving // the nonce currently pending for the account. -func (b *SimulatedBackend) PendingAccountNonce(account common.Address) (uint64, error) { +func (b *SimulatedBackend) PendingAccountNonce(ctx context.Context, account common.Address) (uint64, error) { return b.pendingState.GetOrNewStateObject(account).Nonce(), nil } // SuggestGasPrice implements ContractTransactor.SuggestGasPrice. Since the simulated // chain doens't have miners, we just return a gas price of 1 for any call. -func (b *SimulatedBackend) SuggestGasPrice() (*big.Int, error) { +func (b *SimulatedBackend) SuggestGasPrice(ctx context.Context) (*big.Int, error) { return big.NewInt(1), nil } // EstimateGasLimit implements ContractTransactor.EstimateGasLimit, executing the // requested code against the currently pending block/state and returning the used // gas. -func (b *SimulatedBackend) EstimateGasLimit(sender common.Address, contract *common.Address, value *big.Int, data []byte) (*big.Int, error) { +func (b *SimulatedBackend) EstimateGasLimit(ctx context.Context, sender common.Address, contract *common.Address, value *big.Int, data []byte) (*big.Int, error) { // Create a copy of the currently pending state db to screw around with var ( block = b.pendingBlock @@ -177,7 +178,7 @@ func (b *SimulatedBackend) EstimateGasLimit(sender common.Address, contract *com // SendTransaction implements ContractTransactor.SendTransaction, delegating the raw // transaction injection to the remote node. -func (b *SimulatedBackend) SendTransaction(tx *types.Transaction) error { +func (b *SimulatedBackend) SendTransaction(ctx context.Context, tx *types.Transaction) error { blocks, _ := core.GenerateChain(b.blockchain.CurrentBlock(), b.database, 1, func(number int, block *core.BlockGen) { for _, tx := range b.pendingBlock.Transactions() { block.AddTx(tx) |