Add HasWitness
MODIFY
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
@@ -614,7 +614,7 @@ namespace WalletWasabi.Backend.Controllers
}
// Check duplicates.
- if (!string.IsNullOrWhiteSpace(round.SignedCoinJoin.Inputs[index].WitScript?.ToString())) // Not sure why WitScript?.ToString() is needed, there was something wrong in previous HiddenWallet version if I didn't do this.
+ if (round.SignedCoinJoin.Inputs[index].HasWitness())
{
return BadRequest($"Input is already signed.");
}

MODIFY
WalletWasabi/Extensions/NBitcoinExtensions.cs
WalletWasabi/Extensions/NBitcoinExtensions.cs
@@ -56,5 +56,14 @@ namespace NBitcoin
var output = me.Outputs[outputIndex];
return me.GetIndistinguishableOutputs().Single(x => x.value == output.Value).count - 1;
}
+
+ public static bool HasWitness(this TxIn me)
+ {
+ Guard.NotNull(nameof(me), me);
+
+ bool notNull = me.WitScript != null;
+ bool notEmpty = me.WitScript != WitScript.Empty;
+ return notNull && notEmpty;
+ }
}
}

MODIFY
WalletWasabi/Models/ChaumianCoinJoin/CcjRound.cs
WalletWasabi/Models/ChaumianCoinJoin/CcjRound.cs
@@ -648,7 +648,7 @@ namespace WalletWasabi.Models.ChaumianCoinJoin
using (await RoundSyncronizerLock.LockAsync())
{
// Check if fully signed.
- if (SignedCoinJoin.Inputs.All(x => !string.IsNullOrWhiteSpace(x.WitScript?.ToString()))) // Not sure why WitScript?.ToString() is needed, there was something wrong in previous HiddenWallet version if I didn't do this.
+ if (SignedCoinJoin.Inputs.All(x => x.HasWitness()))
{
Logger.LogInfo<CcjRound>($"Round ({RoundId}): Trying to broadcast coinjoin.");

Add HasWitness