These are chat archives for Nethereum/Nethereum

31st
Dec 2018
Devedse
@devedse
Dec 31 2018 13:04
Hi guys, I'm running into ReplacementTransactionUnderpriced issues when doing some parallel calls on a SmartContract:
    var tasks = new List<Task>();
    for (var i = 0; i < 100; i++)
    {
        var blah = new CreateProductionLocationFunction()
        {
            MemberId = $"Member{i}",
            ProductionLocationId = $"ProdLocId{i}",
            ProductionLocationIdGuid = new BigInteger(i)
        };

        var runnerOfThis = Task.Run(async () =>
        {
            Console.WriteLine($"Deploying location {blah.ProductionLocationIdGuid}");
            var receipt = await contractService.CreateProductionLocationRequestAndWaitForReceiptAsync(blah);
            Console.WriteLine($"{receipt.BlockNumber.Value}: Completed with {blah.ProductionLocationIdGuid}, status: {receipt.Status.Value} {receipt.GasUsed.Value}");
        });

        tasks.Add(runnerOfThis);
    }

    Task.WaitAll(tasks.ToArray());
Is this to be expected doing it like this?
Enigmatic
@EnigmaticUnreal_twitter
Dec 31 2018 14:24
@devedse - I'm half sick right now and I can't keep my eyes opened - so just the top of my head. Most likely you'd need to increment your nonce. If two transactions has the same nonce and same gas price, it'd think the latter transaction is trying to overwrite the former.
Since gas price is the same however, it'd complain and say the gas price is underpriced/not enough to overwrite the previous transaction.
Perhaps I can look into it later when I am better. Or tomorrow. :)
In the meantime, happy new year! (Pardon me for the timezone differences :))