Finish implementing mix cancellation
MODIFY
HiddenWallet.Daemon/Controllers/TumblerController.cs
HiddenWallet.Daemon/Controllers/TumblerController.cs
@@ -92,6 +92,10 @@ namespace HiddenWallet.Daemon.Controllers
return new ObjectResult(new SuccessResponse());
}
+ catch(OperationCanceledException)
+ {
+ return new ObjectResult(new FailureResponse { Message = "Mixing was cancelled" });
+ }
catch (Exception ex)
{
return new ObjectResult(new FailureResponse { Message = ex.Message, Details = ex.ToString() });

MODIFY
HiddenWallet.Daemon/Wrappers/WalletWrapper.cs
HiddenWallet.Daemon/Wrappers/WalletWrapper.cs
@@ -316,13 +316,6 @@ namespace HiddenWallet.Daemon.Wrappers
public async Task<BaseResponse> BuildTransactionAsync(string password, SafeAccount safeAccount, BitcoinAddress address, Money amount, FeeType feeType)
{
- // todo: delete this code comment, it was just a test, if you see it, I forgot to delete it
- //var to = safeAccount != AliceAccount ? AliceAccount : BobAccount;
- //IEnumerable<Script> unusedOutputs = await _walletJob.GetUnusedScriptPubKeysAsync(AddressType.Pay2WitnessPublicKeyHash, to, HdPathType.NonHardened);
- //BitcoinAddress activeOutput = unusedOutputs.RandomElement().GetDestinationAddress(Network); // TODO: this is sub-optimal, it'd be better to not which had been already registered and not reregister it
- //BitcoinWitPubKeyAddress bech32 = new BitcoinWitPubKeyAddress(activeOutput.ToString(), Network);
- //await _walletJob.CoinJoinService.TumbleAsync(safeAccount == AliceAccount ? AliceAccount : BobAccount, bech32, CancellationToken.None);
-
if (password != _password) throw new InvalidOperationException("Wrong password");
var result = await WalletJob.BuildTransactionAsync(address.ScriptPubKey, amount, feeType, safeAccount, (bool)Global.Config.CanSpendUnconfirmed);

MODIFY
HiddenWallet.FullSpvWallet/ChaumianCoinJoin/CoinJoinService.cs
HiddenWallet.FullSpvWallet/ChaumianCoinJoin/CoinJoinService.cs
@@ -222,9 +222,10 @@ namespace HiddenWallet.FullSpvWallet.ChaumianCoinJoin
return CoinJoin?.GetHash();
}
}
- catch(OperationCanceledException)
+ finally
{
- return null;
+ TumblingInProcess = false;
+ UniqueAliceId = null;
}
}

MODIFY
HiddenWallet.Gui/app/html/wallet-content.html
HiddenWallet.Gui/app/html/wallet-content.html
</button>
</div>
</div>
- <button id="cancel-mixing-button" style="display:none" class="btn btn-lg btn-danger btn-block" onclick="cancel-mix()">
+ <button id="cancel-mixing-button" style="display:none" class="btn btn-lg btn-danger btn-block" onclick="cancelMix()">
Cancel Ongoing Mixing
</button>
</div>

MODIFY
HiddenWallet.Gui/app/js/wallet-phase.ts
HiddenWallet.Gui/app/js/wallet-phase.ts
@@ -293,6 +293,18 @@ function mix() {
});
}
+function cancelMix()
+{
+ try {
+ httpGetTumbler("cancel-mix");
+ mixerShow();
+ } catch (e) {
+ alert("Couldn't cancel the mix. Reason:" +
+
+ e);
+ }
+}
+
function updateWalletContent() {
let walletContentFrame: HTMLIFrameElement = <HTMLIFrameElement>document.getElementById("wallet-content-frame");

Finish implementing mix cancellation