If the coord script is not in the cj then don't increment.
MODIFY
WalletWasabi/CoinJoin/Coordinator/Rounds/CoordinatorRound.cs
WalletWasabi/CoinJoin/Coordinator/Rounds/CoordinatorRound.cs
@@ -298,7 +298,7 @@ namespace WalletWasabi.CoinJoin.Coordinator.Rounds
}
}
- var coordinatorScript = await RoundConfig.GetNewCoordinatorScriptAsync();
+ var coordinatorScript = RoundConfig.GetNextCleanCoordinatorScript();
// 3. If there are less Bobs than Alices, then add our own address. The malicious Alice, who will refuse to sign.
for (int i = 0; i < MixingLevels.Count(); i++)
{
@@ -402,6 +402,11 @@ namespace WalletWasabi.CoinJoin.Coordinator.Rounds
transaction.Outputs.SortByAmount();
//Note: We shuffle then sort because inputs and outputs could have equal values
+ if (transaction.Outputs.Any(x => x.ScriptPubKey == coordinatorScript))
+ {
+ await RoundConfig.MakeNextCoordinatorScriptDirtyAsync();
+ }
+
CoinJoin = transaction;
UnsignedCoinJoinHex = transaction.ToHex();

MODIFY
WalletWasabi/CoinJoin/Coordinator/Rounds/CoordinatorRoundConfig.cs
WalletWasabi/CoinJoin/Coordinator/Rounds/CoordinatorRoundConfig.cs
@@ -77,14 +77,12 @@ namespace WalletWasabi.CoinJoin.Coordinator.Rounds
[JsonProperty(PropertyName = "CoordinatorExtPubKeyCurrentDepth", DefaultValueHandling = DefaultValueHandling.Populate)]
public int CoordinatorExtPubKeyCurrentDepth { get; private set; }
- public async Task<Script> GetNewCoordinatorScriptAsync()
- {
- var ret = CoordinatorExtPubKey.Derive(0, false).Derive(CoordinatorExtPubKeyCurrentDepth, false).PubKey.WitHash.ScriptPubKey;
+ public Script GetNextCleanCoordinatorScript() => CoordinatorExtPubKey.Derive(0, false).Derive(CoordinatorExtPubKeyCurrentDepth, false).PubKey.WitHash.ScriptPubKey;
+ public async Task MakeNextCoordinatorScriptDirtyAsync()
+ {
CoordinatorExtPubKeyCurrentDepth++;
await ToFileAsync().ConfigureAwait(false);
-
- return ret;
}
public CoordinatorRoundConfig() : base()

If the coord script is not in the cj then don't increment.