Adjust Send to new logic.
MODIFY
WalletWasabi/Extensions/ExceptionExtensions.cs
WalletWasabi/Extensions/ExceptionExtensions.cs
@@ -20,9 +20,10 @@ namespace System
}
public static Dictionary<string, string> BitcoinCoreTransalations { get; } = new Dictionary<string, string> {
- ["too-long-mempool-chain"] = "At least one coin you are trying to spend is part of long chain of unconfirmed transactions. You must wait for some previous transactions to confirm.",
+ ["too-long-mempool-chain"] = "At least one coin you are trying to spend is part of long or heavy chain of unconfirmed transactions. You must wait for some previous transactions to confirm.",
["bad-txns-inputs-missingorspent"] = "At least one coin you are trying to spend is already spent.",
["missing-inputs"] = "At least one coin you are trying to spend is already spent.",
+ ["txn-mempool-conflict"] = "At least one coin you are trying to spend is already spent.",
["bad-txns-inputs-duplicate"] = "The transaction contains duplicated inputs.",
["bad-txns-nonfinal"] = "The transaction is not final and cannot be broadcasted.",
["bad-txns-oversize"] = "The transaction is too big."
@@ -39,7 +40,7 @@ namespace System
{
foreach (KeyValuePair<string, string> pair in BitcoinCoreTransalations)
{
- if (trimmed.Contains(pair.Key))
+ if (trimmed.Contains(pair.Key, StringComparison.InvariantCultureIgnoreCase))
{
return pair.Value;
}

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -1505,9 +1505,12 @@ namespace WalletWasabi.Services
{
await client.BroadcastAsync(transaction);
}
- catch (HttpRequestException ex2) when (ex2.Message.Contains("txn-mempool-conflict", StringComparison.InvariantCultureIgnoreCase))
+ catch (HttpRequestException ex2) when (
+ ex2.Message.Contains("bad-txns-inputs-missingorspent", StringComparison.InvariantCultureIgnoreCase)
+ || ex2.Message.Contains("missing-inputs", StringComparison.InvariantCultureIgnoreCase)
+ || ex2.Message.Contains("txn-mempool-conflict", StringComparison.InvariantCultureIgnoreCase))
{
- if (transaction.Transaction.Inputs.Count == 1)
+ if (transaction.Transaction.Inputs.Count == 1) // If we tried to only spend one coin, then we can mark it as spent. If there were more coins, then we don't know.
{
OutPoint input = transaction.Transaction.Inputs.First().PrevOut;
SmartCoin coin = Coins.FirstOrDefault(x => x.TransactionId == input.Hash && x.Index == input.N);
@@ -1516,11 +1519,6 @@ namespace WalletWasabi.Services
coin.SpentAccordingToBackend = true;
}
}
- throw new HttpRequestException("Coin has been already spent.");
- }
- catch (HttpRequestException ex2) when (ex2.Message.Contains("too-long-mempool-chain", StringComparison.InvariantCultureIgnoreCase))
- {
- throw new HttpRequestException("There are too many unconfirmed transactions. Please wait for confirmation.");
}
}

Adjust Send to new logic.