Forgot to sub the donation address
This commit is contained in:
+15
-4
@@ -989,16 +989,27 @@ namespace Swarmops.Backend
|
||||
|
||||
public static void AddBitcoinAddress(string address)
|
||||
{
|
||||
JObject json = new JObject();
|
||||
json["op"] = "addr_sub";
|
||||
json["addr"] = address;
|
||||
if (_addressLookup == null)
|
||||
{
|
||||
_addressLookup = new SerializableDictionary<string, bool>();
|
||||
}
|
||||
|
||||
if (!_addressLookup.ContainsKey(address))
|
||||
{
|
||||
JObject json = new JObject();
|
||||
json["op"] = "addr_sub";
|
||||
json["addr"] = address;
|
||||
_blockChainInfoSocket.Send(json.ToString());
|
||||
|
||||
_addressLookup[address] = true; // dupe prevention
|
||||
}
|
||||
|
||||
_blockChainInfoSocket.Send(json.ToString());
|
||||
}
|
||||
|
||||
|
||||
private static WebSocket _blockChainInfoSocket;
|
||||
private static WebSocketServer _socketServer;
|
||||
private static SerializableDictionary<string, JObject> _transactionCache; // Need mechanism to clear this over time
|
||||
private static SerializableDictionary<string, bool> _addressLookup;
|
||||
}
|
||||
}
|
||||
@@ -110,6 +110,10 @@
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="websocket-sharp, Version=1.0.2.59611, Culture=neutral, PublicKeyToken=5660b08a1845a91e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WebSocketSharp.1.0.3-rc11\lib\websocket-sharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Communications\IHasGeography.cs" />
|
||||
|
||||
@@ -12,4 +12,5 @@
|
||||
<package id="NUnit" version="3.5.0" targetFramework="net45" />
|
||||
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
|
||||
<package id="SharpZipLib.Portable" version="0.86.0.0003" targetFramework="net45" />
|
||||
<package id="WebSocketSharp" version="1.0.3-rc11" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -48,7 +48,7 @@
|
||||
<div class="box" style="background-image: url(/Images/Other/coins-background-istockphoto.jpg); background-size: 700px">
|
||||
<div class="content">
|
||||
<div class="odometer-wrapper">
|
||||
<div class="elementFloatFar odometer odometer-currency" id="odoDonatedCents">0.001</div><div class="odometer-label">Annual Profit To Date (Testing new code)</div>
|
||||
<div class="elementFloatFar odometer odometer-currency" id="odoDonatedCents">0.001</div><div class="odometer-label">Received funds (CUR)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,11 +8,14 @@ using System.Web.Services;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using NBitcoin;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Swarmops.Logic.Cache;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Support;
|
||||
using Satoshis = NBitcoin.Money; // Sets it apart from Swarmops' Money class
|
||||
using WebSocketSharp;
|
||||
|
||||
namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
{
|
||||
@@ -54,26 +57,22 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
GuidCache.Set (guid, address.Address);
|
||||
this.LiteralGuid.Text = guid;
|
||||
|
||||
// TEST TEST TEST
|
||||
/*
|
||||
BitcoinSecret secretKey = address.PrivateKey;
|
||||
Coin[] spendableCoin = BitcoinUtility.GetSpendableCoin (secretKey);
|
||||
// Add subscription to address
|
||||
|
||||
TransactionBuilder txBuild = new TransactionBuilder();
|
||||
Transaction tx = txBuild.AddCoins (spendableCoin)
|
||||
.AddKeys (secretKey)
|
||||
.Send (new BitcoinAddress (BitcoinUtility.BitcoinTestAddress), new Satoshis (address.UnspentSatoshis - BitcoinUtility.FeeSatoshisPerThousandBytes))
|
||||
.SendFees (new Satoshis(BitcoinUtility.FeeSatoshisPerThousandBytes))
|
||||
.SetChange (secretKey.GetAddress())
|
||||
.BuildTransaction (true);
|
||||
|
||||
bool test = txBuild.Verify (tx);
|
||||
if (!test)
|
||||
using (
|
||||
WebSocket socket =
|
||||
new WebSocket("ws:/localhost:" + SystemSettings.WebsocketPortFrontend + "?Auth=" +
|
||||
Uri.EscapeDataString(this.CurrentAuthority.ToEncryptedXml())))
|
||||
{
|
||||
throw new InvalidOperationException("Tx is not properly signed");
|
||||
}
|
||||
socket.Connect();
|
||||
|
||||
BitcoinUtility.BroadcastTransaction (tx);*/
|
||||
JObject data = new JObject();
|
||||
data ["ServerRequest"] = "AddBitcoinAddress";
|
||||
data["Address"] = address.Address;
|
||||
|
||||
socket.Send(data.ToString());
|
||||
socket.Close();
|
||||
}
|
||||
|
||||
this.BoxTitle.Text = Resources.Pages.Financial.Donate_PageTitle;
|
||||
this.LabelExplainBitcoinDonation.Text = String.Format (Resources.Pages.Financial.Donate_Explain,
|
||||
|
||||
@@ -83,6 +83,10 @@
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="websocket-sharp, Version=1.0.2.59611, Culture=neutral, PublicKeyToken=5660b08a1845a91e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WebSocketSharp.1.0.3-rc11\lib\websocket-sharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controls\v5\Base\AjaxToggleSlider.ascx.cs">
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
|
||||
<package id="NGeoIP" version="1.0.1" targetFramework="net45" />
|
||||
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
|
||||
<package id="WebSocketSharp" version="1.0.3-rc11" targetFramework="net45" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user