Remove all non-special labels
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
@@ -232,9 +232,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
return;
}
- string[] nonSpecialLabels = Global.WalletService.GetNonSpecialLabels().ToArray();
- IEnumerable<string> suggestedWords = nonSpecialLabels.Where(w => w.StartsWith(lastWord, StringComparison.InvariantCultureIgnoreCase))
- .Union(nonSpecialLabels.Where(w => w.Contains(lastWord, StringComparison.InvariantCultureIgnoreCase)))
+ var labels = Global.WalletService.GetLabels();
+ IEnumerable<string> suggestedWords = labels.Where(w => w.StartsWith(lastWord, StringComparison.InvariantCultureIgnoreCase))
+ .Union(labels.Where(w => w.Contains(lastWord, StringComparison.InvariantCultureIgnoreCase)))
.Except(enteredWordList)
.Take(3);

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -1030,9 +1030,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
return;
}
- string[] nonSpecialLabels = Global.WalletService.GetNonSpecialLabels().ToArray();
- IEnumerable<string> suggestedWords = nonSpecialLabels.Where(w => w.StartsWith(lastWord, StringComparison.InvariantCultureIgnoreCase))
- .Union(nonSpecialLabels.Where(w => w.Contains(lastWord, StringComparison.InvariantCultureIgnoreCase)))
+ var labels = Global.WalletService.GetLabels();
+ IEnumerable<string> suggestedWords = labels.Where(w => w.StartsWith(lastWord, StringComparison.InvariantCultureIgnoreCase))
+ .Union(labels.Where(w => w.Contains(lastWord, StringComparison.InvariantCultureIgnoreCase)))
.Except(enteredWordList)
.Take(3);

MODIFY
WalletWasabi.Tests/RegTests.cs
WalletWasabi.Tests/RegTests.cs
@@ -1091,7 +1091,7 @@ namespace WalletWasabi.Tests
allowUnconfirmed: true);
Assert.Single(res.InnerWalletOutputs);
- Assert.Equal($"{Constants.ChangeOfSpecialLabelStart}my label{Constants.ChangeOfSpecialLabelEnd}", res.InnerWalletOutputs.Single().Label);
+ Assert.Equal("my label", res.InnerWalletOutputs.Single().Label);
amountToSend = wallet.Coins.Where(x => !x.Unavailable).Sum(x => x.Amount) / 3;
res = wallet.BuildTransaction(password, new[] {
@@ -1102,20 +1102,20 @@ namespace WalletWasabi.Tests
Assert.Single(res.InnerWalletOutputs);
Assert.Equal(2, res.OuterWalletOutputs.Count());
- Assert.Equal($"{Constants.ChangeOfSpecialLabelStart}outgoing, outgoing2{Constants.ChangeOfSpecialLabelEnd}", res.InnerWalletOutputs.Single().Label);
+ Assert.Equal("outgoing, outgoing2", res.InnerWalletOutputs.Single().Label);
await wallet.SendTransactionAsync(res.Transaction);
- Assert.Contains($"{Constants.ChangeOfSpecialLabelStart}outgoing, outgoing2{Constants.ChangeOfSpecialLabelEnd}", wallet.Coins.Where(x => x.Height == Height.Mempool).Select(x => x.Label));
- Assert.Contains($"{Constants.ChangeOfSpecialLabelStart}outgoing, outgoing2{Constants.ChangeOfSpecialLabelEnd}", keyManager.GetKeys().Select(x => x.Label));
+ Assert.Contains("outgoing, outgoing2", wallet.Coins.Where(x => x.Height == Height.Mempool).Select(x => x.Label));
+ Assert.Contains("outgoing, outgoing2", keyManager.GetKeys().Select(x => x.Label));
Interlocked.Exchange(ref _filtersProcessedByWalletCount, 0);
await rpc.GenerateAsync(1);
await WaitForFiltersToBeProcessedAsync(TimeSpan.FromSeconds(120), 1);
var bestHeight = new Height(bitcoinStore.HashChain.TipHeight);
- Assert.Contains($"{Constants.ChangeOfSpecialLabelStart}outgoing, outgoing2{Constants.ChangeOfSpecialLabelEnd}", wallet.Coins.Where(x => x.Height == bestHeight).Select(x => x.Label));
- Assert.Contains($"{Constants.ChangeOfSpecialLabelStart}outgoing, outgoing2{Constants.ChangeOfSpecialLabelEnd}", keyManager.GetKeys().Select(x => x.Label));
+ Assert.Contains("outgoing, outgoing2", wallet.Coins.Where(x => x.Height == bestHeight).Select(x => x.Label));
+ Assert.Contains("outgoing, outgoing2", keyManager.GetKeys().Select(x => x.Label));
#endregion Labeling
@@ -3438,7 +3438,7 @@ namespace WalletWasabi.Tests
}
var times = 0;
- while (wallet.Coins.FirstOrDefault(x => x.Label == "ZeroLink Change" && x.Unspent) is null)
+ while (wallet.Coins.FirstOrDefault(x => x.Label == "" && x.Unspent) is null)
{
await Task.Delay(1000);
times++;
@@ -3447,18 +3447,15 @@ namespace WalletWasabi.Tests
throw new TimeoutException("Wallet spends were not recognized.");
}
}
- SmartCoin[] unspentChanges = wallet.Coins.Where(x => x.Label == "ZeroLink Change" && x.Unspent).ToArray();
+ SmartCoin[] unspentChanges = wallet.Coins.Where(x => x.Label == "" && x.Unspent).ToArray();
await wallet.ChaumianClient.DequeueCoinsFromMixAsync(unspentChanges, "");
- Assert.Equal(3, wallet.Coins.Count(x => x.Label == "ZeroLink Mixed Coin" && !x.Unavailable));
- Assert.Equal(3, wallet2.Coins.Count(x => x.Label == "ZeroLink Mixed Coin" && !x.Unavailable));
- 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.Unavailable));
+ Assert.Equal(4, wallet.Coins.Count(x => x.Label == "" && !x.Unavailable));
+ Assert.Equal(3, wallet2.Coins.Count(x => x.Label == "" && !x.Unavailable));
+ Assert.Equal(2, wallet.Coins.Count(x => x.Label == "" && !x.Unspent));
+ Assert.Equal(0, wallet2.Coins.Count(x => x.Label == "" && !x.Unspent));
+ Assert.Equal(3, wallet2.Coins.Count(x => x.Label == ""));
+ Assert.Equal(4, wallet.Coins.Count(x => x.Label == "" && x.Unspent));
}
finally
{

MODIFY
WalletWasabi/Helpers/Constants.cs
WalletWasabi/Helpers/Constants.cs
@@ -74,8 +74,6 @@ namespace WalletWasabi.Helpers
}
}
- public const string ChangeOfSpecialLabelStart = "change of (";
- public const string ChangeOfSpecialLabelEnd = ")";
public const int BigFileReadWriteBufferSize = 1 * 1024 * 1024;
public const int OneDayConfirmationTarget = 144;

MODIFY
WalletWasabi/Services/CcjClient.cs
WalletWasabi/Services/CcjClient.cs
@@ -659,9 +659,6 @@ namespace WalletWasabi.Services
}
}
- string changeLabel = "ZeroLink Change";
- string activeLabel = "ZeroLink Mixed Coin";
-
var keysToSurelyRegister = ExposedLinks.Where(x => coinsToRegister.Contains(x.Key)).SelectMany(x => x.Value).Select(x => x.Key).ToArray();
var keysTryNotToRegister = ExposedLinks.SelectMany(x => x.Value).Select(x => x.Key).Except(keysToSurelyRegister).ToArray();
@@ -688,13 +685,11 @@ namespace WalletWasabi.Services
// Select the change and active keys to register and label them accordingly.
HdPubKey change = allLockedInternalKeys.First();
- change.SetLabel(changeLabel);
var actives = new List<HdPubKey>();
foreach (HdPubKey active in allLockedInternalKeys.Skip(1).Take(maximumMixingLevelCount))
{
actives.Add(active);
- active.SetLabel(activeLabel);
}
// Remember which links we are exposing.
@@ -1033,15 +1028,6 @@ namespace WalletWasabi.Services
State.RemoveCoinFromWaitingList(coinWaitingForMix);
coinWaitingForMix.CoinJoinInProgress = false;
coinWaitingForMix.Secret = null;
- if (coinWaitingForMix.Label == "ZeroLink Change" && coinWaitingForMix.Unspent)
- {
- coinWaitingForMix.Label = "ZeroLink Dequeued Change";
- var key = KeyManager.GetKeys(x => x.P2wpkhScript == coinWaitingForMix.ScriptPubKey).SingleOrDefault();
- if (key != null)
- {
- key.SetLabel(coinWaitingForMix.Label, KeyManager);
- }
- }
CoinDequeued?.Invoke(this, coinWaitingForMix);
var correctReason = Guard.Correct(reason);
var reasonText = correctReason != "" ? $" Reason: {correctReason}" : "";

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -1152,7 +1152,16 @@ namespace WalletWasabi.Services
int outNum = spendAll ? toSend.Length : toSend.Length + 1; // number of addresses to send + 1 for change
int vSize = NBitcoinHelpers.CalculateVsizeAssumeSegwit(inNum, outNum);
Logger.LogInfo<WalletService>($"Estimated tx size: {vSize} vbytes.");
+
+ // Multiply the standard by 1.1 to avoid possible off by one errors in flawed implementations.
+ var minFeeRate = new FeeRate(1.1m * new StandardTransactionPolicy().MinRelayTxFee.SatoshiPerByte);
+ if (feePerBytes < minFeeRate)
+ {
+ feePerBytes = minFeeRate;
+ }
+
Money fee = feePerBytes.GetTotalFee(vSize);
+
Logger.LogInfo<WalletService>($"Fee: {fee.Satoshi} Satoshi.");
// 5. How much to spend?
@@ -1199,10 +1208,10 @@ namespace WalletWasabi.Services
var sb = new StringBuilder();
foreach (var item in realToSend)
{
- sb.Append(item.label ?? "?");
- sb.Append(", ");
+ var corrected = Guard.Correct(item.label);
+ sb.Append($"{corrected}, ");
}
- var changeLabel = $"{Constants.ChangeOfSpecialLabelStart}{sb.ToString().TrimEnd(',', ' ')}{Constants.ChangeOfSpecialLabelEnd}";
+ var changeLabel = sb.ToString().TrimEnd(',', ' ');
if (customChange is null)
{
@@ -1554,12 +1563,12 @@ namespace WalletWasabi.Services
}
}
- public IEnumerable<string> GetNonSpecialLabels()
+ public ISet<string> GetLabels()
{
- return Coins.Where(x => !x.Label.StartsWith("ZeroLink", StringComparison.Ordinal))
- .SelectMany(x => x.Label.Split(new string[] { Constants.ChangeOfSpecialLabelStart, Constants.ChangeOfSpecialLabelEnd, "(", "," }, StringSplitOptions.RemoveEmptyEntries))
+ return Coins
+ .SelectMany(x => x.Label.Split(',', StringSplitOptions.RemoveEmptyEntries))
.Select(x => x.Trim())
- .Distinct();
+ .ToHashSet();
}
private int _refreshCoinHistoriesRerunRequested = 0;

Remove all non-special labels