MCPcopy Create free account
hub / github.com/CPChain/chain / Content

Method Content

internal/cpcapi/api.go:103–127  ·  view source on GitHub ↗

Content returns the transactions contained within the transaction pool.

()

Source from the content-addressed store, hash-verified

101
102// Content returns the transactions contained within the transaction pool.
103func (s *PublicTxPoolAPI) Content() map[string]map[string]map[string]*RPCTransaction {
104 content := map[string]map[string]map[string]*RPCTransaction{
105 "pending": make(map[string]map[string]*RPCTransaction),
106 "queued": make(map[string]map[string]*RPCTransaction),
107 }
108 pending, queue := s.b.TxPoolContent()
109
110 // Flatten the pending transactions
111 for account, txs := range pending {
112 dump := make(map[string]*RPCTransaction)
113 for _, tx := range txs {
114 dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx)
115 }
116 content["pending"][account.Hex()] = dump
117 }
118 // Flatten the queued transactions
119 for account, txs := range queue {
120 dump := make(map[string]*RPCTransaction)
121 for _, tx := range txs {
122 dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx)
123 }
124 content["queued"][account.Hex()] = dump
125 }
126 return content
127}
128
129// Status returns the number of pending and queued transaction in the pool.
130func (s *PublicTxPoolAPI) Status() map[string]hexutil.Uint {

Callers

nothing calls this directly

Calls 3

newRPCPendingTransactionFunction · 0.85
TxPoolContentMethod · 0.65
NonceMethod · 0.65

Tested by

no test coverage detected