mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-03 22:13:10 +00:00
randomizes durability properties
This commit is contained in:
parent
0f8a70cf7f
commit
ea5d145dd9
@ -24,15 +24,16 @@ namespace AutoClient
|
||||
|
||||
public IStoragePurchaseContract RequestStorage(ContentId cid)
|
||||
{
|
||||
var (nodes, tolerance) = GetDurability();
|
||||
var result = Node.Marketplace.RequestStorage(new StoragePurchaseRequest(cid)
|
||||
{
|
||||
CollateralPerByte = app.Config.CollateralPerByte.TstWei(),
|
||||
Duration = GetDuration(),
|
||||
Expiry = TimeSpan.FromMinutes(app.Config.ContractExpiryMinutes),
|
||||
MinRequiredNumberOfNodes = Convert.ToUInt32(app.Config.NumHosts),
|
||||
NodeFailureTolerance = Convert.ToUInt32(app.Config.HostTolerance),
|
||||
MinRequiredNumberOfNodes = nodes,
|
||||
NodeFailureTolerance = tolerance,
|
||||
PricePerBytePerSecond = GetPricePerBytePerSecond(),
|
||||
ProofProbability = 15
|
||||
ProofProbability = GetProofProbability()
|
||||
});
|
||||
return result;
|
||||
}
|
||||
@ -61,5 +62,22 @@ namespace AutoClient
|
||||
|
||||
return TimeSpan.FromMinutes(i);
|
||||
}
|
||||
|
||||
private (uint, uint) GetDurability()
|
||||
{
|
||||
(uint, uint)[] options = [
|
||||
(4, 2),
|
||||
(5, 2),
|
||||
(10, 5),
|
||||
(20, 10)
|
||||
];
|
||||
|
||||
return options[r.Next(0, options.Length)];
|
||||
}
|
||||
|
||||
private int GetProofProbability()
|
||||
{
|
||||
return r.Next(10, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,9 +44,11 @@ namespace AutoClient
|
||||
public void Queue(Action<CodexWrapper> action)
|
||||
{
|
||||
if (queue.Count > 2) log.Log("Queue full. Waiting...");
|
||||
var sleep = 0.1;
|
||||
while (queue.Count > 2)
|
||||
{
|
||||
Thread.Sleep(TimeSpan.FromSeconds(1.0));
|
||||
Thread.Sleep(TimeSpan.FromSeconds(sleep));
|
||||
sleep *= 2.0;
|
||||
}
|
||||
|
||||
lock (queueLock)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user