From df64a9f5ef463f8b3d64076e663fda0eed2ef542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 27 Jun 2016 18:28:34 +0300 Subject: [release/1.4.17] core, eth, miner: only retain 1 tx/nonce, remove bad ones (cherry picked from commit 795b70423eac7180ab85b735f64aae9d6a10449d) --- eth/api.go | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'eth') 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 } -- cgit v1.2.3