From b033a6d45ef8167fa291f8642dbf24806454a364 Mon Sep 17 00:00:00 2001 From: Edgar Aroutiounian Date: Fri, 10 Jan 2020 19:29:36 -0800 Subject: [PATCH] [rpc] Simplify Pending txn (#2065) --- internal/hmyapi/transactionpool.go | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/internal/hmyapi/transactionpool.go b/internal/hmyapi/transactionpool.go index f3a220f8c..ae64ac4d1 100644 --- a/internal/hmyapi/transactionpool.go +++ b/internal/hmyapi/transactionpool.go @@ -333,28 +333,14 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, ha } // PendingTransactions returns the transactions that are in the transaction pool -// and have a from address that is one of the accounts this node manages. func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error) { pending, err := s.b.GetPoolTransactions() if err != nil { return nil, err } - accounts := make(map[common.Address]struct{}) - for _, wallet := range s.b.AccountManager().Wallets() { - for _, account := range wallet.Accounts() { - accounts[account.Address] = struct{}{} - } - } - transactions := make([]*RPCTransaction, 0, len(pending)) - for _, tx := range pending { - var signer types.Signer = types.HomesteadSigner{} - if tx.Protected() { - signer = types.NewEIP155Signer(tx.ChainID()) - } - from, _ := types.Sender(signer, tx) - if _, exists := accounts[from]; exists { - transactions = append(transactions, newRPCPendingTransaction(tx)) - } + transactions := make([]*RPCTransaction, len(pending)) + for i := range pending { + transactions[i] = newRPCPendingTransaction(pending[i]) } return transactions, nil }