Skip to content

Commit

Permalink
e2e: fix TestGouging NDF
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Apr 19, 2024
1 parent 7c1c040 commit 4bc2aed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
11 changes: 4 additions & 7 deletions internal/test/e2e/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,18 +689,15 @@ func (c *TestCluster) AddHost(h *Host) {
c.hosts = append(c.hosts, h)

// Fund host from bus.
res, err := c.Bus.Wallet(context.Background())
c.tt.OK(err)

fundAmt := res.Confirmed.Div64(2).Div64(uint64(len(c.hosts))) // 50% of bus balance
fundAmt := types.Siacoins(100e3)
var scos []types.SiacoinOutput
for i := 0; i < 10; i++ {
scos = append(scos, types.SiacoinOutput{
Value: fundAmt.Div64(10),
Value: fundAmt,
Address: h.WalletAddress(),
})
}
c.tt.OK(c.Bus.SendSiacoins(context.Background(), scos, true))
c.tt.OK(c.Bus.SendSiacoins(context.Background(), scos, false))

// Mine transaction.
c.MineBlocks(1)
Expand All @@ -720,7 +717,7 @@ func (c *TestCluster) AddHost(h *Host) {
c.tt.Helper()

c.MineBlocks(1)
_, err = c.Bus.Host(context.Background(), h.PublicKey())
_, err := c.Bus.Host(context.Background(), h.PublicKey())
if err != nil {
return err
}
Expand Down
5 changes: 4 additions & 1 deletion internal/test/e2e/gouging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func TestGouging(t *testing.T) {

// create a new test cluster
cluster := newTestCluster(t, testClusterOptions{
hosts: int(test.AutopilotConfig.Contracts.Amount),
logger: newTestLoggerCustom(zapcore.ErrorLevel),
})
defer cluster.Shutdown()
Expand All @@ -36,6 +35,10 @@ func TestGouging(t *testing.T) {
// mine enough blocks for the current period to become > period
cluster.MineBlocks(int(cfg.Period) * 2)

// add hosts
tt.OKAll(cluster.AddHostsBlocking(int(test.AutopilotConfig.Contracts.Amount)))
cluster.WaitForAccounts()

// build a hosts map
hostsMap := make(map[string]*Host)
for _, h := range cluster.hosts {
Expand Down

0 comments on commit 4bc2aed

Please sign in to comment.