diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-06-27 23:28:34 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-10-10 16:41:58 +0800 |
commit | df64a9f5ef463f8b3d64076e663fda0eed2ef542 (patch) | |
tree | dadafbe01a3a68b7084209c7f9579e106db52a09 /eth | |
parent | 4fced0972d9bf2802cb9c3eb16cedc79c9dd60a1 (diff) | |
download | go-tangerine-df64a9f5ef463f8b3d64076e663fda0eed2ef542.tar go-tangerine-df64a9f5ef463f8b3d64076e663fda0eed2ef542.tar.gz go-tangerine-df64a9f5ef463f8b3d64076e663fda0eed2ef542.tar.bz2 go-tangerine-df64a9f5ef463f8b3d64076e663fda0eed2ef542.tar.lz go-tangerine-df64a9f5ef463f8b3d64076e663fda0eed2ef542.tar.xz go-tangerine-df64a9f5ef463f8b3d64076e663fda0eed2ef542.tar.zst go-tangerine-df64a9f5ef463f8b3d64076e663fda0eed2ef542.zip |
[release/1.4.17] core, eth, miner: only retain 1 tx/nonce, remove bad ones
(cherry picked from commit 795b70423eac7180ab85b735f64aae9d6a10449d)
Diffstat (limited to 'eth')
-rw-r--r-- | eth/api.go | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/eth/api.go b/eth/api.go index 7cdeb7199..43e00fc06 100644 --- a/eth/api.go +++ b/eth/api.go @@ -324,22 +324,18 @@ func (s *PublicTxPoolAPI) Content() map[string]map[string]map[string][]*RPCTrans // Flatten the pending transactions for account, batches := range pending { dump := make(map[string][]*RPCTransaction) - for nonce, txs := range batches { - nonce := fmt.Sprintf("%d", nonce) - for _, tx := range txs { - dump[nonce] = append(dump[nonce], newRPCPendingTransaction(tx)) - } + for _, tx := range batches { + nonce := fmt.Sprintf("%d", tx.Nonce()) + dump[nonce] = []*RPCTransaction{newRPCPendingTransaction(tx)} } content["pending"][account.Hex()] = dump } // Flatten the queued transactions for account, batches := range queue { dump := make(map[string][]*RPCTransaction) - for nonce, txs := range batches { - nonce := fmt.Sprintf("%d", nonce) - for _, tx := range txs { - dump[nonce] = append(dump[nonce], newRPCPendingTransaction(tx)) - } + for _, tx := range batches { + nonce := fmt.Sprintf("%d", tx.Nonce()) + dump[nonce] = []*RPCTransaction{newRPCPendingTransaction(tx)} } content["queued"][account.Hex()] = dump } @@ -374,22 +370,18 @@ func (s *PublicTxPoolAPI) Inspect() map[string]map[string]map[string][]string { // Flatten the pending transactions for account, batches := range pending { dump := make(map[string][]string) - for nonce, txs := range batches { - nonce := fmt.Sprintf("%d", nonce) - for _, tx := range txs { - dump[nonce] = append(dump[nonce], format(tx)) - } + for _, tx := range batches { + nonce := fmt.Sprintf("%d", tx.Nonce()) + dump[nonce] = []string{format(tx)} } content["pending"][account.Hex()] = dump } // Flatten the queued transactions for account, batches := range queue { dump := make(map[string][]string) - for nonce, txs := range batches { - nonce := fmt.Sprintf("%d", nonce) - for _, tx := range txs { - dump[nonce] = append(dump[nonce], format(tx)) - } + for _, tx := range batches { + nonce := fmt.Sprintf("%d", tx.Nonce()) + dump[nonce] = []string{format(tx)} } content["queued"][account.Hex()] = dump } |