Propagate CJ, Store CJ
MODIFY
HiddenWallet.ChaumianTumbler/Controllers/TumblerController.cs
HiddenWallet.ChaumianTumbler/Controllers/TumblerController.cs
@@ -376,8 +376,20 @@ namespace HiddenWallet.ChaumianTumbler.Controllers
// check if fully signed
if(Global.StateMachine.CoinJoin.Inputs.All(x => x.WitScript != default))
{
- // propagate transaction
- // save coinjoin to coinjoinstore
+ var res = await Global.RpcClient.SendCommandAsync(RPCOperations.sendrawtransaction, Global.StateMachine.CoinJoin.ToHex(), true);
+ var state = CoinJoinTransactionState.Failed;
+ if (Global.StateMachine.CoinJoin.GetHash().ToString() == res.ToString())
+ {
+ state = CoinJoinTransactionState.Succeeded;
+ }
+ Global.CoinJoinStore.Transactions.Add(new CoinJoinTransaction
+ {
+ Transaction = Global.StateMachine.CoinJoin,
+ DateTime = DateTimeOffset.UtcNow,
+ State = state
+ });
+ await Global.CoinJoinStore.ToFileAsync(Global.CoinJoinStorePath);
+
// progress round
throw new NotImplementedException();
}

MODIFY
HiddenWallet.ChaumianTumbler/Global.cs
HiddenWallet.ChaumianTumbler/Global.cs
@@ -5,6 +5,7 @@ using HiddenWallet.Helpers;
using NBitcoin.RPC;
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -16,6 +17,7 @@ namespace HiddenWallet.ChaumianTumbler
public static Config Config;
public static CoinJoinStore CoinJoinStore;
+ public static string CoinJoinStorePath = Path.Combine(DataDir, "CoinJoins.json");
public static RPCClient RpcClient;

MODIFY
HiddenWallet.ChaumianTumbler/Program.cs
HiddenWallet.ChaumianTumbler/Program.cs
@@ -51,10 +51,9 @@ namespace HiddenWallet.ChaumianTumbler
network: Global.Config.Network);
await AssertRpcNodeFullyInitializedAsync();
- string coinJoinStorePath = Path.Combine(Global.DataDir, "CoinJoins.json");
- if(File.Exists(coinJoinStorePath))
+ if(File.Exists(Global.CoinJoinStorePath))
{
- Global.CoinJoinStore = await CoinJoinStore.CreateFromFileAsync(coinJoinStorePath);
+ Global.CoinJoinStore = await CoinJoinStore.CreateFromFileAsync(Global.CoinJoinStorePath);
}
else
{

MODIFY
HiddenWallet.ChaumianTumbler/Store/CoinJoinTransaction.cs
HiddenWallet.ChaumianTumbler/Store/CoinJoinTransaction.cs
@@ -14,7 +14,7 @@ namespace HiddenWallet.ChaumianTumbler.Store
{
[JsonProperty(PropertyName = "Hex")]
[JsonConverter(typeof(TransactionHexConverter))]
- public Transaction Transaction { get; private set; }
+ public Transaction Transaction { get; set; }
[JsonProperty(PropertyName = "State")]
[JsonConverter(typeof(StringEnumConverter))]

Propagate CJ, Store CJ