ethclient: add test for pending block retrieval

This commit is contained in:
islishude 2025-03-27 16:34:35 +08:00 committed by lightclient
parent ad5d463ceb
commit 8a84834134
No known key found for this signature in database
GPG key ID: 657913021EF45A6A

View file

@ -307,6 +307,12 @@ func testTransactionInBlock(t *testing.T, client *rpc.Client) {
if tx.Hash() != testTx2.Hash() { if tx.Hash() != testTx2.Hash() {
t.Fatalf("unexpected transaction: %v", tx) t.Fatalf("unexpected transaction: %v", tx)
} }
// Test pending block
_, err = ec.BlockByNumber(context.Background(), big.NewInt(int64(rpc.PendingBlockNumber)))
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
} }
func testChainID(t *testing.T, client *rpc.Client) { func testChainID(t *testing.T, client *rpc.Client) {