mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-20 13:34:37 +01:00
Do not use Random
This commit is contained in:
parent
1fc114fec7
commit
af9d896510
2 changed files with 2 additions and 4 deletions
|
@ -350,13 +350,12 @@ namespace BTCPayServer.Payments.PayJoin
|
|||
&& feeOutputIndex < newTx.Outputs.Count
|
||||
&& !isOurOutput.Contains(newTx.Outputs[feeOutputIndex])
|
||||
? newTx.Outputs[feeOutputIndex] : null;
|
||||
var rand = new Random();
|
||||
int senderInputCount = newTx.Inputs.Count;
|
||||
foreach (var selectedUTXO in selectedUTXOs.Select(o => o.Value))
|
||||
{
|
||||
contributedAmount += (Money)selectedUTXO.Value;
|
||||
var newInput = newTx.Inputs.Add(selectedUTXO.Outpoint);
|
||||
newInput.Sequence = newTx.Inputs[rand.Next(0, senderInputCount)].Sequence;
|
||||
newInput.Sequence = newTx.Inputs[(int)(RandomUtils.GetUInt32() % senderInputCount)].Sequence;
|
||||
}
|
||||
ourNewOutput.Value += contributedAmount;
|
||||
var minRelayTxFee = this._dashboard.Get(network.CryptoCode).Status.BitcoinStatus?.MinRelayTxFee ??
|
||||
|
|
|
@ -52,11 +52,10 @@ namespace BTCPayServer.Security.Bitpay
|
|||
// It is legacy support and Bitpay generate string of unknown format, trying to replicate them
|
||||
// as good as possible. The string below got generated for me.
|
||||
var chars = "ERo0vkBMOYhyU0ZHvirCplbLDIGWPdi1ok77VnW7QdE";
|
||||
var rand = new Random(Math.Abs(RandomUtils.GetInt32()));
|
||||
var generated = new char[chars.Length];
|
||||
for (int i = 0; i < generated.Length; i++)
|
||||
{
|
||||
generated[i] = chars[rand.Next(0, generated.Length)];
|
||||
generated[i] = chars[(int)(RandomUtils.GetUInt32() % generated.Length)];
|
||||
}
|
||||
|
||||
using (var ctx = _Factory.CreateContext())
|
||||
|
|
Loading…
Add table
Reference in a new issue