PendingTransactions returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.
()
| 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. |
| 1613 | func (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. |
nothing calls this directly
no test coverage detected