lukechampine / user

A CLI renter for Sia
MIT License
12 stars 2 forks source link

Feature Request: Duplicate host contracts #13

Open grigzy28 opened 5 years ago

grigzy28 commented 5 years ago

Have user inform the user when forming new contracts that an existing non _old contract is already in the available folder and not marked as being re-negotiated or expired.

I was able to form two different contracts with a single host(unknowingly) and of course the upload test failed when trying to upload to the same host with two different contracts. It came up with some error about duplicate host contracts (can't recall exactly, was a while ago.)

lukechampine commented 5 years ago

I wonder how best to handle this. We could prompt during formation, e.g.:

$ user contracts form x y z
WARNING: You already have a contract with that host (abc-def.contract).
Press ENTER to archive that contract and proceed, or Ctrl-C to abort.

or we could archive automatically and print a message notifying the user what happened.

grigzy28 commented 5 years ago

Now archiving the original contract would still hold up the funds until the contract expires on the blockchain. I think the option of being able to abort formation would be useful in that instance, unless maybe the program does a tattle of that contract? Offering to do that could be an option thus preventing the scenario of two active contracts with a single host.

lukechampine commented 5 years ago

good point. I think prompting the user is the way to go. And instead of automatically archiving, it should just tell the user that they'll need to disable one of the contracts before uploading or downloading.

tattle will submit a revision, but you still won't get your money back until the contract ends, so it doesn't help much here.

grigzy28 commented 5 years ago

I mistakenly used tattle in the previous example. I had meant the renew command. But also in this case I think telling the user to that there is an already existing contract is probably the best way to go, even offering to renew the existing contract would require the end user to input some data as well as if they just renewed manually.

vargrant commented 5 years ago

I think we must to have settings like minimal and maximal redunancy. Also we must to have own statistics by all contracts for all times. In case if we will have situation when we will have "duplicate contracts" (i mean that same chunk will be uploaded to several hosts) then we must to reduce redunancy to our maximal_level_of_redunancy. But we need to select which hosts can delete our data - here we can use our own time statistics for a contract. We have 3 wasy for posibillity to select good hosts - cheapest contract (low price storage, low upload, low price download) or hight perforamce (we can use our real data which we can to have in process of usage this contracts in previous time) or stabily of host (i think this must be preffered way by default, beucase previous 2 ways must be already used on previous steps when we created contracts). So we have 3 ways - then we can provide this option for users like a settings from command line or configuration file.