Skip to content

Commit

Permalink
worker: schedule sync on max bal exceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan committed Aug 21, 2024
1 parent ecfb8a9 commit 4668f56
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions worker/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package worker

import (
"context"
"errors"
"fmt"
"io"
"time"
Expand Down Expand Up @@ -244,6 +245,9 @@ func (h *host) FundAccount(ctx context.Context, desired types.Currency, rev *typ

// fund the account
if err := h.client.FundAccount(ctx, rev, h.hk, h.siamuxAddr, deposit, h.acc.id, pt.HostPriceTable, h.renterKey); err != nil {
if rhp3.IsBalanceMaxExceeded(err) {
err = errors.Join(err, h.acc.as.ScheduleSync(ctx, h.acc.id, h.hk))
}
return types.ZeroCurrency, fmt.Errorf("failed to fund account with %v; %w", deposit, err)
}

Expand Down

0 comments on commit 4668f56

Please sign in to comment.