internal/ethapi: fix tx nonces in pool inspect/content

This commit is contained in:
Péter Szilágyi 2017-05-29 11:14:56 +03:00
parent cb809c03da
commit 673c92db6b
No known key found for this signature in database
GPG Key ID: E9AE538CEDF8293D

View File

@ -118,16 +118,16 @@ func (s *PublicTxPoolAPI) Content() map[string]map[string]map[string]*RPCTransac
// Flatten the pending transactions // Flatten the pending transactions
for account, txs := range pending { for account, txs := range pending {
dump := make(map[string]*RPCTransaction) dump := make(map[string]*RPCTransaction)
for nonce, tx := range txs { for _, tx := range txs {
dump[fmt.Sprintf("%d", nonce)] = newRPCPendingTransaction(tx) dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx)
} }
content["pending"][account.Hex()] = dump content["pending"][account.Hex()] = dump
} }
// Flatten the queued transactions // Flatten the queued transactions
for account, txs := range queue { for account, txs := range queue {
dump := make(map[string]*RPCTransaction) dump := make(map[string]*RPCTransaction)
for nonce, tx := range txs { for _, tx := range txs {
dump[fmt.Sprintf("%d", nonce)] = newRPCPendingTransaction(tx) dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx)
} }
content["queued"][account.Hex()] = dump content["queued"][account.Hex()] = dump
} }
@ -162,16 +162,16 @@ func (s *PublicTxPoolAPI) Inspect() map[string]map[string]map[string]string {
// Flatten the pending transactions // Flatten the pending transactions
for account, txs := range pending { for account, txs := range pending {
dump := make(map[string]string) dump := make(map[string]string)
for nonce, tx := range txs { for _, tx := range txs {
dump[fmt.Sprintf("%d", nonce)] = format(tx) dump[fmt.Sprintf("%d", tx.Nonce())] = format(tx)
} }
content["pending"][account.Hex()] = dump content["pending"][account.Hex()] = dump
} }
// Flatten the queued transactions // Flatten the queued transactions
for account, txs := range queue { for account, txs := range queue {
dump := make(map[string]string) dump := make(map[string]string)
for nonce, tx := range txs { for _, tx := range txs {
dump[fmt.Sprintf("%d", nonce)] = format(tx) dump[fmt.Sprintf("%d", tx.Nonce())] = format(tx)
} }
content["queued"][account.Hex()] = dump content["queued"][account.Hex()] = dump
} }