Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fasmat committed Aug 13, 2024
1 parent e9900a0 commit 341ab18
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions fetch/p2p_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,12 @@ func TestP2PGetATXs(t *testing.T) {
func(t *testing.T, ctx context.Context, tpf *testP2PFetch, errStr string) {
epoch := types.EpochID(11)
atx := newAtx(tpf.t, epoch)
require.NoError(tpf.t, atxs.Add(tpf.serverCDB, atx, types.AtxBlob{}))
blob := types.AtxBlob{Blob: types.RandomBytes(100)}
require.NoError(tpf.t, atxs.Add(tpf.serverCDB, atx, blob))
tpf.verifyGetHash(
func() error { return tpf.clientFetch.GetAtxs(context.Background(), []types.ATXID{atx.ID()}) },
errStr, "atx", "hs/1", types.Hash32(atx.ID()), atx.ID().Bytes(),
[]byte{},
blob.Blob,
)
})
}
Expand Down Expand Up @@ -477,12 +478,10 @@ func TestP2PGetBlockTransactions(t *testing.T) {
tx := genTx(t, signer, types.Address{1}, 1, 1, 1)
require.NoError(t, transactions.Add(tpf.serverCDB, &tx, time.Now()))
tpf.verifyGetHash(
func() error {
return tpf.clientFetch.GetBlockTxs(
context.Background(), []types.TransactionID{tx.ID})
},
func() error { return tpf.clientFetch.GetBlockTxs(context.Background(), []types.TransactionID{tx.ID}) },
errStr, "txBlock", "hs/1", types.Hash32(tx.ID), tx.ID.Bytes(),
tx.Raw)
tx.Raw,
)
})
}

Expand Down Expand Up @@ -510,8 +509,7 @@ func TestP2PGetMalfeasanceProofs(t *testing.T) {
func(t *testing.T, ctx context.Context, tpf *testP2PFetch, errStr string) {
nid := types.RandomNodeID()
proof := types.RandomBytes(11)
require.NoError(t, identities.SetMalicious(
tpf.serverCDB, nid, proof, time.Now()))
require.NoError(t, identities.SetMalicious(tpf.serverCDB, nid, proof, time.Now()))
tpf.verifyGetHash(
func() error { return tpf.clientFetch.GetMalfeasanceProofs(context.Background(), []types.NodeID{nid}) },
errStr, "mal", "hs/1", types.Hash32(nid), nid.Bytes(),
Expand Down

0 comments on commit 341ab18

Please sign in to comment.