diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-07-10 17:43:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-10 17:43:23 +0800 |
commit | 4f7a38001f7137972303421a11d49b0745450a3a (patch) | |
tree | 0a486e90fd8cf7d2ab161610b79a2251483895c0 /eth/api_backend.go | |
parent | 65f0e905ddda9be97368839b67be5754b33a0eea (diff) | |
parent | 34ec9913f628180d0ace740abfe1362995879c93 (diff) | |
download | go-tangerine-4f7a38001f7137972303421a11d49b0745450a3a.tar go-tangerine-4f7a38001f7137972303421a11d49b0745450a3a.tar.gz go-tangerine-4f7a38001f7137972303421a11d49b0745450a3a.tar.bz2 go-tangerine-4f7a38001f7137972303421a11d49b0745450a3a.tar.lz go-tangerine-4f7a38001f7137972303421a11d49b0745450a3a.tar.xz go-tangerine-4f7a38001f7137972303421a11d49b0745450a3a.tar.zst go-tangerine-4f7a38001f7137972303421a11d49b0745450a3a.zip |
Merge pull request #14737 from holiman/txpool_localaccounts
Txpool localaccounts
Diffstat (limited to 'eth/api_backend.go')
-rw-r--r-- | eth/api_backend.go | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/eth/api_backend.go b/eth/api_backend.go index 166b5084d..7ef7c030d 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -116,29 +116,18 @@ func (b *EthApiBackend) GetEVM(ctx context.Context, msg core.Message, state *sta } func (b *EthApiBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error { - b.eth.txMu.Lock() - defer b.eth.txMu.Unlock() - - b.eth.txPool.SetLocal(signedTx) - return b.eth.txPool.Add(signedTx) + return b.eth.txPool.AddLocal(signedTx) } func (b *EthApiBackend) RemoveTx(txHash common.Hash) { - b.eth.txMu.Lock() - defer b.eth.txMu.Unlock() - b.eth.txPool.Remove(txHash) } func (b *EthApiBackend) GetPoolTransactions() (types.Transactions, error) { - b.eth.txMu.Lock() - defer b.eth.txMu.Unlock() - pending, err := b.eth.txPool.Pending() if err != nil { return nil, err } - var txs types.Transactions for _, batch := range pending { txs = append(txs, batch...) @@ -147,30 +136,18 @@ func (b *EthApiBackend) GetPoolTransactions() (types.Transactions, error) { } func (b *EthApiBackend) GetPoolTransaction(hash common.Hash) *types.Transaction { - b.eth.txMu.Lock() - defer b.eth.txMu.Unlock() - return b.eth.txPool.Get(hash) } func (b *EthApiBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) { - b.eth.txMu.Lock() - defer b.eth.txMu.Unlock() - return b.eth.txPool.State().GetNonce(addr), nil } func (b *EthApiBackend) Stats() (pending int, queued int) { - b.eth.txMu.Lock() - defer b.eth.txMu.Unlock() - return b.eth.txPool.Stats() } func (b *EthApiBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) { - b.eth.txMu.Lock() - defer b.eth.txMu.Unlock() - return b.eth.TxPool().Content() } |