Bitcoin Echo Test seems to work all the way

This commit is contained in:
Rick Falkvinge
2017-11-23 05:20:05 +01:00
parent 24d70c4c77
commit c7efc79c62
14 changed files with 66 additions and 75 deletions
+2 -2
View File
@@ -105,7 +105,7 @@ namespace Swarmops.Logic.Financial
return
ExtKey.Parse(
"Replace this with your own favorite secret root key for debugging, and remember to never commit it to Github :)");
"Write your favorite root private key here");
}
return
@@ -346,7 +346,7 @@ namespace Swarmops.Logic.Financial
JArray unspentArray;
if ((int)addressInfoResult["balanceSat"] == 0)
if ((int)addressInfoResult["balanceSat"] == 0 && (int)addressInfoResult["unconfirmedBalanceSat"] == 0)
{
return false; // no funds on address at all at this time
}
+3 -2
View File
@@ -47,7 +47,7 @@ namespace Swarmops.Logic.Support
return;
}
MethodInfo methodFromXml = serviceClassType.GetMethod("FromXml", BindingFlags.FlattenHierarchy | BindingFlags.Static);
MethodInfo methodFromXml = serviceClassType.GetMethod("FromXml", BindingFlags.FlattenHierarchy | BindingFlags.Static | BindingFlags.Public);
if (methodFromXml == null)
{
@@ -56,6 +56,7 @@ namespace Swarmops.Logic.Support
}
IBackendServiceOrderBase order = (IBackendServiceOrderBase) methodFromXml.Invoke(null, new object[] { this.OrderXml });
order.ServiceOrderIdentity = this.Identity; // not part of serialization
// Mark as started
@@ -80,7 +81,7 @@ namespace Swarmops.Logic.Support
{
order.Close();
}
catch (ConcurrencyException)
catch (DatabaseConcurrencyException)
{
// Ignore if we try to close it twice in this particular failure scenario
}
@@ -21,7 +21,7 @@ namespace Swarmops.Logic.Support.BackendServices
{
public virtual string ToXml()
{
XmlSerializer serializer = new XmlSerializer(GetType());
XmlSerializer serializer = new XmlSerializer(this.GetType());
MemoryStream stream = new MemoryStream();
serializer.Serialize(stream, this);
@@ -68,7 +68,7 @@ namespace Swarmops.Logic.Support.BackendServices
/// </summary>
public virtual void Run()
{
throw new NotImplementedException("The base Run() has no implementation. Derive and override!");
throw new NotImplementedException("The base Run() has no implementation. Derive and declare 'override'!");
}
/// <summary>
@@ -14,12 +14,18 @@ namespace Swarmops.Logic.Support.BackendServices
[Serializable]
public class ReturnBitcoinEchoUtxoOrder: BackendServiceOrderBase<ReturnBitcoinEchoUtxoOrder>
{
public ReturnBitcoinEchoUtxoOrder(BasicHotBitcoinAddressUnspent utxo)
[Obsolete("Never call the parameterless ctor from code; intended for use by serialization only.", true)]
public ReturnBitcoinEchoUtxoOrder()
{
this.UtxoIdentity = utxo.Identity;
// Never call -- intended for use by serialization only
}
public new void Run()
public ReturnBitcoinEchoUtxoOrder(BasicHotBitcoinAddressUnspent utxo)
{
this.UtxoIdentity = utxo == null? 0: utxo.Identity;
}
public override void Run()
{
HotBitcoinAddressUnspent utxoToReturn = HotBitcoinAddressUnspent.FromIdentity(UtxoIdentity);
HotBitcoinAddress utxoAddress = utxoToReturn.Address;
@@ -14,5 +14,6 @@ namespace Swarmops.Logic.Support
void Close();
bool HasWorkerThread { get; set; }
Thread WorkerThread { get; set; }
int ServiceOrderIdentity { get; set; }
}
}