Skip to content

Commit

Permalink
- fixed recent transactions incorrect visual status when starting the…
Browse files Browse the repository at this point in the history
… app and connecting to slow nodes
  • Loading branch information
firestorm40 committed Sep 19, 2024
1 parent d9467b4 commit 4a36d6f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
7 changes: 7 additions & 0 deletions Spixi/Meta/Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,16 @@ public override void shutdown()

static public void setNetworkBlock(ulong block_height, byte[] block_checksum, int block_version)
{
ulong _oldNetworkBlockHeight = networkBlockHeight;
networkBlockHeight = block_height;
networkBlockChecksum = block_checksum;
networkBlockVersion = block_version;

// If there is a considerable change in blockheight, update the transaction lists
if (_oldNetworkBlockHeight + Config.txConfirmationBlocks < networkBlockHeight)
{
TransactionCache.updateCacheChangeStatus();
}
}

public override void receivedTransactionInclusionVerificationResponse(byte[] txid, bool verified)
Expand Down
14 changes: 8 additions & 6 deletions Spixi/Storage/TransactionCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ public static bool addTransaction(StorageTransaction t, bool writeToFile = true)
if(writeToFile)
Node.localStorage.writeTransactionCacheFile();

lastChange++;
if (lastChange > 100000)
lastChange = 0;
updateCacheChangeStatus();

return true;
}
Expand Down Expand Up @@ -148,9 +146,7 @@ public static bool addUnconfirmedTransaction(StorageTransaction t, bool writeToF
if (writeToFile)
Node.localStorage.writeTransactionCacheFile();

lastChange++;
if (lastChange > 100000)
lastChange = 0;
updateCacheChangeStatus();

return true;
}
Expand All @@ -174,6 +170,12 @@ public static void clearAllTransactions()
unconfirmedTransactions.Clear();
}

updateCacheChangeStatus();
}

// Updates the last change status of the Transaction Cache
public static void updateCacheChangeStatus()
{
lastChange++;
if (lastChange > 100000)
lastChange = 0;
Expand Down

0 comments on commit 4a36d6f

Please sign in to comment.