Make sure user is able to dequeue changes.
MODIFY
WalletWasabi.Tests/RegTests.cs
WalletWasabi.Tests/RegTests.cs
@@ -2577,7 +2577,7 @@ namespace WalletWasabi.Tests
Assert.True(3 == (await chaumianClient2.QueueCoinsToMixAsync(password, wallet2.Coins.ToArray())).Count());
Task timeout = Task.Delay(TimeSpan.FromSeconds(2*(connectionConfirmationTimeout * 2 + 7 * 2 + 7 * 2 + 7 * 2)));
- while (wallet.Coins.Count <= 3)
+ while (wallet.Coins.Count != 7)
{
if (timeout.IsCompletedSuccessfully)
{
@@ -2585,6 +2585,26 @@ namespace WalletWasabi.Tests
}
await Task.Delay(1000);
}
+
+ var times = 0;
+ while (wallet.Coins.Where(x => x.Label == "ZeroLink Change" && x.Unspent).SingleOrDefault() == null)
+ {
+ await Task.Delay(1000);
+ times++;
+ if (times >= 21) throw new TimeoutException("Wallet spends were not recognized.");
+ }
+ SmartCoin[] unspentChanges = wallet.Coins.Where(x => x.Label == "ZeroLink Change" && x.Unspent).ToArray();
+ await wallet.ChaumianClient.DequeueCoinsFromMixAsync(unspentChanges);
+
+ Assert.Equal(3, wallet.Coins.Count(x => x.Label == "ZeroLink Mixed Coin" && !x.SpentOrLocked));
+ Assert.Equal(3, wallet2.Coins.Count(x => x.Label == "ZeroLink Mixed Coin" && !x.SpentOrLocked));
+ Assert.Equal(0, wallet.Coins.Count(x => x.Label == "ZeroLink Mixed Coin" && !x.Unspent));
+ Assert.Equal(0, wallet2.Coins.Count(x => x.Label == "ZeroLink Mixed Coin" && !x.Unspent));
+ Assert.Equal(2, wallet.Coins.Count(x => x.Label == "ZeroLink Change" && !x.Unspent));
+ Assert.Equal(0, wallet2.Coins.Count(x => x.Label == "ZeroLink Change"));
+ Assert.Equal(0, wallet.Coins.Count(x => x.Label == "ZeroLink Change" && x.Unspent));
+ Assert.Equal(0, wallet.Coins.Count(x => x.Label == "ZeroLink Dequeued Change" && !x.Unspent));
+ Assert.Equal(1, wallet.Coins.Count(x => x.Label == "ZeroLink Dequeued Change" && !x.SpentOrLocked));
}
finally
{

MODIFY
WalletWasabi/Services/CcjClient.cs
WalletWasabi/Services/CcjClient.cs
@@ -589,6 +589,15 @@ namespace WalletWasabi.Services
State.RemoveCoinFromWaitingList(coinWaitingForMix);
coinWaitingForMix.Locked = false;
coinWaitingForMix.Secret = null;
+ if (coinWaitingForMix.Label == "ZeroLink Change" && coinWaitingForMix.Unspent)
+ {
+ coinWaitingForMix.Label = "ZeroLink Dequeued Change";
+ var key = KeyManager.GetKeys().SingleOrDefault(x => x.GetP2wpkhScript() == coinWaitingForMix.ScriptPubKey);
+ if (key != null)
+ {
+ key.Label = coinWaitingForMix.Label;
+ }
+ }
Logger.LogInfo<CcjClient>($"Coin dequeued: {coinWaitingForMix.Index}:{coinWaitingForMix.TransactionId}.");
}
}

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -332,7 +332,7 @@ namespace WalletWasabi.Services
foundKey.KeyState = KeyState.Used;
var coin = new SmartCoin(tx.GetHash(), i, output.ScriptPubKey, output.Value, tx.Transaction.Inputs.ToTxoRefs().ToArray(), tx.Height, tx.Transaction.RBF, foundKey.Label, spenderTransactionId: null, locked: false); // Don't inherit locked status from key, that's different.
Coins.Add(coin);
- if (coin.Label == "ZeroLink Change" && ChaumianClient.OnePiece != null)
+ if (coin.Unspent && coin.Label == "ZeroLink Change" && ChaumianClient.OnePiece != null)
{
Task.Run(async () =>
{
@@ -806,6 +806,17 @@ namespace WalletWasabi.Services
return haveEnough;
}
+ public void Renamelabel(SmartCoin coin, string newLabel)
+ {
+ newLabel = Guard.Correct(newLabel);
+ coin.Label = newLabel;
+ var key = KeyManager.GetKeys().SingleOrDefault(x => x.GetP2wpkhScript() == coin.ScriptPubKey);
+ if(key != null)
+ {
+ key.Label = newLabel;
+ }
+ }
+
public async Task SendTransactionAsync(SmartTransaction transaction)
{
using (var torClient = new TorHttpClient(IndexDownloader.Client.DestinationUri, IndexDownloader.Client.TorSocks5EndPoint, isolateStream: true))

Make sure user is able to dequeue changes.