Commit 6a7b31b3 authored by David Vorick's avatar David Vorick

Merge branch 'blacklist-recoverable-contracts' into 'unstable'

Blacklist recoverable contracts

See merge request !3439
parents 39ca6270 0e0e278c
Pipeline #47296178 failed with stages
in 22 minutes and 11 seconds
......@@ -908,6 +908,12 @@ func (c *Contractor) threadedContractMaintenance() {
addressBlacklist = append(addressBlacklist, contract.HostPublicKey)
}
}
// Add the hosts we have recoverable contracts with to the blacklist to
// avoid losing existing data by forming a new/empty contract.
for _, contract := range c.recoverableContracts {
blacklist = append(blacklist, contract.HostPublicKey)
}
initialContractFunds := c.allowance.Funds.Div64(c.allowance.Hosts).Div64(3)
c.mu.RUnlock()
hosts, err := c.hdb.RandomHosts(neededContracts*2+randomHostsBufferForScore, blacklist, addressBlacklist)
......
......@@ -4095,12 +4095,9 @@ func TestRenterContractRecovery(t *testing.T) {
t.Fatal(err)
}
// Start a new renter with the same seed but skip setting the allowance.
// This will prevent new contracts from being formed while already formed
// contracts will still be recovered.
// Start a new renter with the same seed.
renterParams := node.Renter(newRenterDir)
renterParams.PrimarySeed = seed
renterParams.SkipSetAllowance = true
nodes, err := tg.AddNodes(renterParams)
if 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