mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
This commit is contained in:
parent
165d0f0838
commit
737bfa45a6
1 changed files with 12 additions and 12 deletions
|
|
@ -185,15 +185,15 @@ func NewTxPoolAPI(b Backend) *TxPoolAPI {
|
|||
|
||||
// Content returns the transactions contained within the transaction pool.
|
||||
func (s *TxPoolAPI) Content() map[string]map[string]map[string]*RPCTransaction {
|
||||
content := map[string]map[string]map[string]*RPCTransaction{
|
||||
"pending": make(map[string]map[string]*RPCTransaction),
|
||||
"queued": make(map[string]map[string]*RPCTransaction),
|
||||
}
|
||||
pending, queue := s.b.TxPoolContent()
|
||||
content := map[string]map[string]map[string]*RPCTransaction{
|
||||
"pending": make(map[string]map[string]*RPCTransaction, len(pending)),
|
||||
"queued": make(map[string]map[string]*RPCTransaction, len(queue)),
|
||||
}
|
||||
curHeader := s.b.CurrentHeader()
|
||||
// Flatten the pending transactions
|
||||
for account, txs := range pending {
|
||||
dump := make(map[string]*RPCTransaction)
|
||||
dump := make(map[string]*RPCTransaction, len(txs))
|
||||
for _, tx := range txs {
|
||||
dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx, curHeader, s.b.ChainConfig())
|
||||
}
|
||||
|
|
@ -201,7 +201,7 @@ func (s *TxPoolAPI) Content() map[string]map[string]map[string]*RPCTransaction {
|
|||
}
|
||||
// Flatten the queued transactions
|
||||
for account, txs := range queue {
|
||||
dump := make(map[string]*RPCTransaction)
|
||||
dump := make(map[string]*RPCTransaction, len(txs))
|
||||
for _, tx := range txs {
|
||||
dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx, curHeader, s.b.ChainConfig())
|
||||
}
|
||||
|
|
@ -245,11 +245,11 @@ func (s *TxPoolAPI) Status() map[string]hexutil.Uint {
|
|||
// Inspect retrieves the content of the transaction pool and flattens it into an
|
||||
// easily inspectable list.
|
||||
func (s *TxPoolAPI) Inspect() map[string]map[string]map[string]string {
|
||||
content := map[string]map[string]map[string]string{
|
||||
"pending": make(map[string]map[string]string),
|
||||
"queued": make(map[string]map[string]string),
|
||||
}
|
||||
pending, queue := s.b.TxPoolContent()
|
||||
content := map[string]map[string]map[string]string{
|
||||
"pending": make(map[string]map[string]string, len(pending)),
|
||||
"queued": make(map[string]map[string]string, len(queue)),
|
||||
}
|
||||
|
||||
// Define a formatter to flatten a transaction into a string
|
||||
var format = func(tx *types.Transaction) string {
|
||||
|
|
@ -260,7 +260,7 @@ func (s *TxPoolAPI) Inspect() map[string]map[string]map[string]string {
|
|||
}
|
||||
// Flatten the pending transactions
|
||||
for account, txs := range pending {
|
||||
dump := make(map[string]string)
|
||||
dump := make(map[string]string, len(txs))
|
||||
for _, tx := range txs {
|
||||
dump[fmt.Sprintf("%d", tx.Nonce())] = format(tx)
|
||||
}
|
||||
|
|
@ -268,7 +268,7 @@ func (s *TxPoolAPI) Inspect() map[string]map[string]map[string]string {
|
|||
}
|
||||
// Flatten the queued transactions
|
||||
for account, txs := range queue {
|
||||
dump := make(map[string]string)
|
||||
dump := make(map[string]string, len(txs))
|
||||
for _, tx := range txs {
|
||||
dump[fmt.Sprintf("%d", tx.Nonce())] = format(tx)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue