Commit 63a5e7b5 authored by Chris Schinnerl's avatar Chris Schinnerl

add dependency to prevent ea funding

parent 4574eb23
Pipeline #152510030 failed with stages
in 28 minutes and 8 seconds
......@@ -237,6 +237,9 @@ func (w *worker) managedAccountNeedsRefill() bool {
// managedRefillAccount will refill the account if it needs to be refilled
func (w *worker) managedRefillAccount() {
if w.renter.deps.Disrupt("DisableFunding") {
return // don't refill account
}
// the account balance dropped to below half the balance target, refill
balance := w.staticAccount.managedAvailableBalance()
amount := w.staticBalanceTarget.Sub(balance)
......
......@@ -9,6 +9,10 @@ import (
)
type (
// DependencyPreventEARefill prevents EAs from being refilled automatically.
DependencyPreventEARefill struct {
modules.ProductionDependencies
}
// DependencyLowFundsFormationFail will cause contract formation to fail due
// to low funds in the allowance.
DependencyLowFundsFormationFail struct {
......@@ -199,6 +203,11 @@ func newDependencyInterruptAfterNCalls(str string, n int) *DependencyInterruptAf
}
}
// Disrupt returns true if the correct string is provided.
func (d *DependencyPreventEARefill) Disrupt(s string) bool {
return s == "DisableFunding"
}
// Disrupt returns true if the correct string is provided.
func (d *DependencyBlockResumeJobDownloadUntilTimeout) Disrupt(s string) bool {
if s == "BlockUntilTimeout" {
......
......@@ -312,7 +312,9 @@ func TestHostContracts(t *testing.T) {
t.Fatal("expected host to have no contracts")
}
if _, err := tg.AddNodes(node.RenterTemplate); err != nil {
r := node.RenterTemplate
r.RenterDeps = &dependencies.DependencyPreventEARefill{}
if _, err := tg.AddNodes(r); err != nil {
t.Fatal(err)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment