Commit 3ec8fc95 authored by David Vorick's avatar David Vorick

narrow down RenewDynamicIP failure

parent 328d305f
......@@ -848,25 +848,23 @@ func TestHostDBAndRenterRenewDynamicIPs(t *testing.T) {
// Close and re-open the host. This should reset the host's address, as the
// host should now be on a new port.
/*
err = stHost.server.Close()
if err != nil {
t.Fatal(err)
}
stHost, err = assembleServerTester(stHost.walletKey, stHost.dir)
if err != nil {
t.Fatal(err)
}
sts[1] = stHost
err = fullyConnectNodes(sts)
if err != nil {
t.Fatal(err)
}
err = stHost.announceHost()
if err != nil {
t.Fatal(err)
}
*/
err = stHost.server.Close()
if err != nil {
t.Fatal(err)
}
stHost, err = assembleServerTester(stHost.walletKey, stHost.dir)
if err != nil {
t.Fatal(err)
}
sts[1] = stHost
err = fullyConnectNodes(sts)
if err != nil {
t.Fatal(err)
}
err = stHost.announceHost()
if err != nil {
t.Fatal(err)
}
// Pull the host's net address and pubkey from the hostdb.
err = retry(50, time.Millisecond*100, func() error {
// Get the hostdb internals.
......@@ -894,6 +892,7 @@ func TestHostDBAndRenterRenewDynamicIPs(t *testing.T) {
// Mine enough blocks that multiple renew cylces happen. After the renewing
// happens, the file should still be downloadable.
println("mining blocks")
for i := 0; i < testPeriodInt*2; i++ {
_, err = st.miner.AddBlock()
if err != nil {
......
......@@ -14,10 +14,13 @@ import (
// It returns the new contract. This is a blocking call that performs network
// I/O.
func (c *Contractor) managedRenew(contract modules.RenterContract, numSectors uint64, newEndHeight types.BlockHeight) (modules.RenterContract, error) {
println("performing renew")
host, ok := c.hdb.Host(contract.HostPublicKey)
if !ok {
println("a")
return modules.RenterContract{}, errors.New("no record of that host")
} else if host.StoragePrice.Cmp(maxStoragePrice) > 0 {
println("b")
return modules.RenterContract{}, errTooExpensive
}
// cap host.MaxCollateral
......@@ -31,6 +34,7 @@ func (c *Contractor) managedRenew(contract modules.RenterContract, numSectors ui
// get an address to use for negotiation
uc, err := c.wallet.NextAddress()
if err != nil {
println("c")
return modules.RenterContract{}, err
}
......@@ -58,6 +62,7 @@ func (c *Contractor) managedRenew(contract modules.RenterContract, numSectors ui
if !ok {
// nothing we can do; return original error
c.log.Printf("wanted to recover contract %v with host %v, but no revision was cached", contract.ID, contract.NetAddress)
println("d")
return modules.RenterContract{}, err
}
c.log.Printf("host %v has different revision for %v; retrying with cached revision", contract.NetAddress, contract.ID)
......@@ -68,9 +73,11 @@ func (c *Contractor) managedRenew(contract modules.RenterContract, numSectors ui
}
if err != nil {
txnBuilder.Drop() // return unused outputs to wallet
println("e")
return modules.RenterContract{}, err
}
println("renew successful")
return newContract, nil
}
......
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