Ninja update
This commit is contained in:
@@ -2,7 +2,7 @@ Package: swarmops-backend
|
||||
Version: --BuildNumber--
|
||||
Architecture: all
|
||||
Maintainer: Rick Falkvinge (swarmops-maintain@falkvinge.net)
|
||||
Depends: swarmops-common (>= --BuildNumber--),mono-runtime (>= 3.2.8),libmono-corlib4.0-cil (>= 3.2.8),libmono-posix4.0-cil (>= 3.2.8),libmono-system-data4.0-cil (>= 3.2.8),libmono-system-web-http4.0-cil (>= 3.2.8)
|
||||
Depends: swarmops-common (>= --BuildNumber--),mono-runtime (>= 3.2.8),libmono-corlib4.0-cil (>= 3.2.8),libmono-posix4.0-cil (>= 3.2.8),libmono-system-data4.0-cil (>= 3.2.8),libmono-system-web-http4.0-cil (>= 3.2.8),libmono-system-numerics4.0-cil
|
||||
Conflicts: swarmops-backend-internal,swarmops-backend-stable
|
||||
Homepage: http://swarmops.com/
|
||||
Description: Swarmops Backend
|
||||
|
||||
@@ -2,7 +2,7 @@ Package: swarmops-common
|
||||
Version: --BuildNumber--
|
||||
Architecture: all
|
||||
Maintainer: Rick Falkvinge (swarmops-maintain@falkvinge.net)
|
||||
Depends: libmono-system-componentmodel-composition4.0-cil (>= 3.2.8),libmono-system-web-services4.0-cil (>= 3.2.8),libmono-system-web-extensions4.0-cil (>= 3.2.8),libmono-system-componentmodel-composition4.0-cil (>= 3.2.8),fonts-liberation
|
||||
Depends: libmono-system-componentmodel-composition4.0-cil (>= 3.2.8),libmono-system-web-services4.0-cil (>= 3.2.8),libmono-system-web-extensions4.0-cil (>= 3.2.8),libmono-system-componentmodel-composition4.0-cil (>= 3.2.8),fonts-liberation,libmono-system-numerics4.0-cil
|
||||
Conflicts: swarmops-common-internal,swarmops-common-stable
|
||||
Homepage: http://swarmops.com/
|
||||
Description: Swarmops Common
|
||||
|
||||
@@ -144,6 +144,8 @@ namespace Swarmops.Logic.Communications.Payload
|
||||
System_DatabaseSchemaUpgraded,
|
||||
System_DatabaseUpgradeFailed,
|
||||
System_MailServerTest,
|
||||
System_PublicRootReset,
|
||||
System_UnrecognizedPayload,
|
||||
CashAdvance_Requested,
|
||||
CashAdvance_Attested,
|
||||
CashAdvance_Deattested,
|
||||
|
||||
@@ -13,6 +13,8 @@ using NBitcoin;
|
||||
using NBitcoin.BouncyCastle.Asn1.Ocsp;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Swarmops.Database;
|
||||
using Swarmops.Logic.Communications;
|
||||
using Swarmops.Logic.Communications.Payload;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Support;
|
||||
|
||||
@@ -36,7 +38,11 @@ namespace Swarmops.Logic.Financial
|
||||
ExtKey privateRoot = new ExtKey();
|
||||
File.WriteAllText(SystemSettings.EtcFolder + Path.DirectorySeparatorChar + "hotwallet", privateRoot.GetWif(Network.Main).ToWif(), Encoding.ASCII);
|
||||
File.WriteAllText(SystemSettings.EtcFolder + Path.DirectorySeparatorChar + "hotwallet-created-" + DateTime.UtcNow.ToString("yyyy-MM-dd--HH-mm-ss--fff.backup"), privateRoot.GetWif(Network.Main).ToWif(), Encoding.ASCII); // an extra backup
|
||||
Persistence.Key["BitcoinHotPublicRoot"] = privateRoot.Neuter().GetWif(Network.Main).ToWif();
|
||||
|
||||
if (String.IsNullOrEmpty (Persistence.Key["BitcoinHotPublicRoot"]))
|
||||
{
|
||||
Persistence.Key["BitcoinHotPublicRoot"] = privateRoot.Neuter().GetWif (Network.Main).ToWif();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -52,6 +58,19 @@ namespace Swarmops.Logic.Financial
|
||||
// TODO: Log some sort of exception (the sandbox db is reset every night, so it's ok to lose the public key from there)
|
||||
}
|
||||
}
|
||||
|
||||
// Is the hotwallet public root equal to the private root, while in production environment?
|
||||
|
||||
// ReSharper disable once RedundantCheckBeforeAssignment
|
||||
if (Persistence.Key["BitcoinHotPublicRoot"] !=
|
||||
BitcoinHotPrivateRoot.Neuter().GetWif (Network.Main).ToWif() && !Debugger.IsAttached)
|
||||
{
|
||||
// SERIOUS CONDITION - the public root key did not match the private root key. This needs to be logged somewhere.
|
||||
OutboundComm.CreateNotification (NotificationResource.System_PublicRootReset);
|
||||
|
||||
// Reset it
|
||||
Persistence.Key["BitcoinHotPublicRoot"] = BitcoinHotPrivateRoot.Neuter().GetWif(Network.Main).ToWif();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,15 +247,18 @@ namespace Swarmops.Logic.Financial
|
||||
foreach (var tx in addressData["txs"])
|
||||
{
|
||||
string blockchainTransactionId = (string) tx["hash"];
|
||||
FinancialTransaction ourTx = null;
|
||||
|
||||
try
|
||||
{
|
||||
FinancialTransaction ourTx = FinancialTransaction.FromBlockchainHash(parent.Organization, blockchainTransactionId);
|
||||
// If the transaction was fetched fine, we have already seen this transaction, and all is fine
|
||||
ourTx = FinancialTransaction.FromBlockchainHash(parent.Organization, blockchainTransactionId);
|
||||
// If the transaction was fetched fine, we have already seen this transaction, but need to re-check it
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
// We didn't have this transaction, so we need to create it
|
||||
|
||||
// ourTx = FinancialTransaction.Create (parent.Organization, DateTime, Description)
|
||||
// Did we lose or gain money?
|
||||
|
||||
// Find all in- and outpoints, determine which are ours (hot and cold wallet) and which aren't
|
||||
|
||||
+38
@@ -787,6 +787,24 @@ namespace Swarmops.Logic.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The bitcoin public root key in the MySql database was not a match for the bitcoin private root key stored in /etc/swarmops on [HostName]. This is a potentially serious condition, and should never ever happen, so the public root key was rederived from the private key and re-written to the database over what was there before..
|
||||
/// </summary>
|
||||
internal static string System_PublicRootReset_Body {
|
||||
get {
|
||||
return ResourceManager.GetString("System_PublicRootReset_Body", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Swarmops: Hotwallet public root key reset.
|
||||
/// </summary>
|
||||
internal static string System_PublicRootReset_Subject {
|
||||
get {
|
||||
return ResourceManager.GetString("System_PublicRootReset_Subject", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Swarmops Backend version [SwarmopsVersion] on host [HostName] has successfully started and connected to database and notification frameworks..
|
||||
/// </summary>
|
||||
@@ -804,5 +822,25 @@ namespace Swarmops.Logic.Resources {
|
||||
return ResourceManager.GetString("System_Startup_Subject", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The Swarmops transmission engine on [HostName] has encountered an unknown payload type ([UnrecognizedPayloadType]). This should only happen at very rare occasions in conjunction with upgrades where an upgraded version has to take care of something that changed names in the process, itself a rare phenomenon.
|
||||
///
|
||||
///If this error is recurring, you may have a badly installed plugin or something similar. In any case, the unrecognized message has been discarded and won't be transmitted, since Swarmops doesn't know h [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string System_UnrecognizedPayload_Body {
|
||||
get {
|
||||
return ResourceManager.GetString("System_UnrecognizedPayload_Body", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Swarmops: Unrecognized comms payload.
|
||||
/// </summary>
|
||||
internal static string System_UnrecognizedPayload_Subject {
|
||||
get {
|
||||
return ResourceManager.GetString("System_UnrecognizedPayload_Subject", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,10 +435,24 @@ The upgrade will be retried every hour. Some functionality may be disabled until
|
||||
<data name="System_MailServerTest_Subject" xml:space="preserve">
|
||||
<value>Swarmops Mail Server Test</value>
|
||||
</data>
|
||||
<data name="System_PublicRootReset_Body" xml:space="preserve">
|
||||
<value>The bitcoin public root key in the MySql database was not a match for the bitcoin private root key stored in /etc/swarmops on [HostName]. This is a potentially serious condition, and should never ever happen, so the public root key was rederived from the private key and re-written to the database over what was there before.</value>
|
||||
</data>
|
||||
<data name="System_PublicRootReset_Subject" xml:space="preserve">
|
||||
<value>Swarmops: Hotwallet public root key reset</value>
|
||||
</data>
|
||||
<data name="System_Startup_Body" xml:space="preserve">
|
||||
<value>Swarmops Backend version [SwarmopsVersion] on host [HostName] has successfully started and connected to database and notification frameworks.</value>
|
||||
</data>
|
||||
<data name="System_Startup_Subject" xml:space="preserve">
|
||||
<value>Swarmops Backend operational</value>
|
||||
</data>
|
||||
<data name="System_UnrecognizedPayload_Body" xml:space="preserve">
|
||||
<value>The Swarmops transmission engine on [HostName] has encountered an unknown payload type ([UnrecognizedPayloadType]). This should only happen at very rare occasions in conjunction with upgrades where an upgraded version has to take care of something that changed names in the process, itself a rare phenomenon.
|
||||
|
||||
If this error is recurring, you may have a badly installed plugin or something similar. In any case, the unrecognized message has been discarded and won't be transmitted, since Swarmops doesn't know how.</value>
|
||||
</data>
|
||||
<data name="System_UnrecognizedPayload_Subject" xml:space="preserve">
|
||||
<value>Swarmops: Unrecognized comms payload</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -28,6 +28,15 @@ namespace Swarmops.Utility.Communications
|
||||
Assembly assembly = typeof(PayloadEnvelope).Assembly;
|
||||
|
||||
Type payloadType = assembly.GetType(envelope.PayloadClass);
|
||||
if (payloadType == null)
|
||||
{
|
||||
NotificationCustomStrings customStrings = new NotificationCustomStrings();
|
||||
customStrings["UnrecognizedPayloadType"] = envelope.PayloadClass;
|
||||
OutboundComm.CreateNotification (null, NotificationResource.System_UnrecognizedPayload, customStrings);
|
||||
|
||||
throw new OutboundCommTransmitException("Unrecognized or uninstantiable payload type: " + envelope.PayloadClass);
|
||||
}
|
||||
|
||||
var methodInfo = payloadType.GetMethod("FromXml", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
|
||||
|
||||
ICommsRenderer renderer = (ICommsRenderer)(methodInfo.Invoke(null, new object[] { envelope.PayloadXml }));
|
||||
|
||||
Reference in New Issue
Block a user