Skip to content

Commit

Permalink
Releast v0.3.16
Browse files Browse the repository at this point in the history
CRITICAL: File corruption when etching files with lots of repetitive
data.  Some wallets cannot handle rapid transactions to the exact same
address.  A wait for confirmation was added if the next address matches
the very last address.
  • Loading branch information
embiimob committed Nov 12, 2017
1 parent 91ba436 commit a3d8bb2
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ADD/About.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 56 additions & 4 deletions ADD/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ public void CreateLedgerFile(int PayloadByteSize, string Padding, string WalletR
string cglText = "";
Dictionary<string, decimal> toMany = new Dictionary<string, decimal>();
Dictionary<string, decimal> lastTransaction = new Dictionary<string, decimal>();
string lastT = null;
string curT = null;
string lastTransactionID = null;
HashSet<string> addressHash = new HashSet<string>(StringComparer.Ordinal);
string signingAddress = null;
Expand Down Expand Up @@ -618,13 +620,28 @@ public void CreateLedgerFile(int PayloadByteSize, string Padding, string WalletR
}
catch
{
//Cannot send to the same address more than twice in any transaction
//Cannot send to the same address more than twice in any one transaction
//If data is identical use previous transaction instead of archiving identical data.
if (lastTransaction.SequenceEqual(toMany))
{ transactionId = lastTransactionID; }
else
{

if (lastTransaction.Count > 0 && toMany.Count > 0)
{
lastT = lastTransaction.Last().Key;
curT = toMany.Last().Key;
//Wait for the wallet to catch up if sending to exact same address in a row.
if (lastT == curT)
{
ledgerCount = 1;
while (ledgerCount > 0)
{
transLookup = b.GetTransaction(lastTransactionID);
if (transLookup.confirmations > 0) { ledgerCount = 0; } else { System.Threading.Thread.Sleep(5000); }
}
}
}

transactionId = b.SendMany(WalletLabel, toMany);
System.Threading.Thread.Sleep(1000);
ledgerCount++;
Expand Down Expand Up @@ -664,6 +681,24 @@ public void CreateLedgerFile(int PayloadByteSize, string Padding, string WalletR
{
//Breaking transaction file into size specified in wallet settings


if (lastTransaction.Count > 0 && toMany.Count > 0)
{
lastT = lastTransaction.Last().Key;
curT = toMany.Last().Key;
//Wait for the wallet to catch up if sending to exact same address in a row.
if (lastT == curT)
{
ledgerCount = 1;
while (ledgerCount > 0)
{
transLookup = b.GetTransaction(lastTransactionID);
if (transLookup.confirmations > 0) { ledgerCount = 0; } else { System.Threading.Thread.Sleep(5000); }
}
}
}


transactionId = b.SendMany(WalletLabel, toMany);
System.Threading.Thread.Sleep(1000);
ledgerCount++;
Expand Down Expand Up @@ -707,8 +742,25 @@ public void CreateLedgerFile(int PayloadByteSize, string Padding, string WalletR
}
if (toMany.Count > 0)
{
//Catching the straglers
transactionId = b.SendMany(WalletLabel, toMany);

if (lastTransaction.Count > 0 && toMany.Count > 0)
{
lastT = lastTransaction.Last().Key;
curT = toMany.Last().Key;
//Wait for the wallet to catch up if sending to exact same address in a row.
if (lastT == curT)
{
ledgerCount = 1;
while (ledgerCount > 0)
{
transLookup = b.GetTransaction(lastTransactionID);
if (transLookup.confirmations > 0) { ledgerCount = 0; } else { System.Threading.Thread.Sleep(5000); }
}
}
}

//Catching the straglers
transactionId = b.SendMany(WalletLabel, toMany);
arcLedger.WriteLine(transactionId);
arcLedger.Flush();
lastTransaction = new Dictionary<string, decimal>(toMany);
Expand Down
2 changes: 1 addition & 1 deletion ADD/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.15")]
[assembly: AssemblyVersion("0.3.16")]

0 comments on commit a3d8bb2

Please sign in to comment.