fix: eth_newPendingTransactionFilter doesn't return ethereum tx hash (#1012)

* Problem: eth_newPendingTransactionFilter don't return correct tx hash

Closes: #1011
Solution:
- use eth tx hash rather than tendermint one

* changelog

* remove copied TODO comment and ignore err result of Notify

* add e2e test

* fix ws client in e2e test

* fix test

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
yihuang
2022-03-24 07:56:59 +00:00
committed by GitHub
co-authored by Federico Kunze Küllmer
parent 42b5e443da
commit 70d52948da
5 changed files with 60 additions and 24 deletions
+26
View File
@@ -721,3 +721,29 @@ func (s *IntegrationTestSuite) TestWeb3Sha3() {
})
}
}
func (s *IntegrationTestSuite) TestPendingTransactionFilter() {
var (
filterID string
filterResult []common.Hash
)
// create filter
err := s.rpcClient.Call(&filterID, "eth_newPendingTransactionFilter")
s.Require().NoError(err)
// check filter result is empty
err = s.rpcClient.Call(&filterResult, "eth_getFilterChanges", filterID)
s.Require().NoError(err)
s.Require().Empty(filterResult)
// send transaction
signedTx := s.signValidTx(common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), big.NewInt(10)).AsTransaction()
err = s.network.Validators[0].JSONRPCClient.SendTransaction(s.ctx, signedTx)
s.Require().NoError(err)
s.waitForTransaction()
s.expectSuccessReceipt(signedTx.Hash())
// check filter changes match the tx hash
err = s.rpcClient.Call(&filterResult, "eth_getFilterChanges", filterID)
s.Require().NoError(err)
s.Require().Equal([]common.Hash{signedTx.Hash()}, filterResult)
}