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

Method PendingTransactions

internal/cpcapi/api.go:1613–1636  ·  view source on GitHub ↗

PendingTransactions returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.

()

Source from the content-addressed store, hash-verified

1611// PendingTransactions returns the transactions that are in the transaction pool
1612// and have a from address that is one of the accounts this node manages.
1613func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error) {
1614 pending, err := s.b.GetPoolTransactions()
1615 if err != nil {
1616 return nil, err
1617 }
1618 accounts := make(map[common.Address]struct{})
1619 for _, wallet := range s.b.AccountManager().Wallets() {
1620 for _, account := range wallet.Accounts() {
1621 accounts[account.Address] = struct{}{}
1622 }
1623 }
1624 transactions := make([]*RPCTransaction, 0, len(pending))
1625 for _, tx := range pending {
1626 var signer types.Signer = types.HomesteadSigner{}
1627 if tx.Protected() {
1628 signer = types.NewCep1Signer(tx.ChainId())
1629 }
1630 from, _ := types.Sender(signer, tx)
1631 if _, exists := accounts[from]; exists {
1632 transactions = append(transactions, newRPCPendingTransaction(tx))
1633 }
1634 }
1635 return transactions, nil
1636}
1637
1638// Resend accepts an existing transaction and a new gas price and limit. It will remove
1639// the given transaction from the pool and reinsert it with the new gas price and limit.

Callers

nothing calls this directly

Calls 8

newRPCPendingTransactionFunction · 0.85
GetPoolTransactionsMethod · 0.65
WalletsMethod · 0.65
AccountManagerMethod · 0.65
AccountsMethod · 0.65
SenderMethod · 0.65
ProtectedMethod · 0.45
ChainIdMethod · 0.45

Tested by

no test coverage detected