Skip to content

Commit

Permalink
- updated APIs
Browse files Browse the repository at this point in the history
- stability fixes and optimizations
- added support for dynamic RN fee
  • Loading branch information
IxiAngel committed Mar 27, 2024
1 parent aed11eb commit cd8dd36
Show file tree
Hide file tree
Showing 10 changed files with 392 additions and 214 deletions.
63 changes: 37 additions & 26 deletions IxianDLT/API/APIServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,16 @@ protected override bool processRequest(HttpListenerContext context, string metho
blockData.Add("Compacted Sigs", block.compactedSigs.ToString());
blockData.Add("Signature count", block.signatures.Count.ToString());
blockData.Add("Required Signature count", Node.blockChain.getRequiredConsensusFromStorage(block.blockNum).ToString());
blockData.Add("Total Signer Difficulty", block.getTotalSignerDifficulty().ToString());
blockData.Add("Required Signer Difficulty", Node.blockChain.getRequiredSignerDifficulty(block, true).ToString());
var totalSignerDifficulty = Node.blockChain.getBlockTotalSignerDifficulty(block.blockNum);
if (totalSignerDifficulty == null)
{
totalSignerDifficulty = block.getTotalSignerDifficulty();
}
blockData.Add("Total Signer Difficulty", totalSignerDifficulty.ToString());
if (block.version >= BlockVer.v10)
{
blockData.Add("Required Signer Difficulty", Node.blockChain.getRequiredSignerDifficulty(block, true).ToString());
}
blockData.Add("Transaction count", block.transactions.Count.ToString());
blockData.Add("Transaction amount", TransactionPool.getTotalTransactionsValueInBlock(block).ToString());
blockData.Add("Total fees", block.totalFee.ToString());
Expand Down Expand Up @@ -787,33 +795,36 @@ public JsonResponse onStatus(Dictionary<string, object> parameters)
if (parameters.ContainsKey("vv") || parameters.ContainsKey("verbose"))
{
networkArray.Add("Required Consensus", Node.blockChain.getRequiredConsensus());
networkArray.Add("Signer Difficulty", Node.blockChain.getRequiredSignerDifficulty(Node.blockChain.getLastBlock(), false).ToString());
networkArray.Add("Signer Bits", Crypto.hashToString(BitConverter.GetBytes(Node.blockChain.getRequiredSignerBits())));
networkArray.Add("Signer Hashrate", Node.signerPowMiner.lastHashRate);

var tmpSolution = Node.signerPowMiner.lastSignerPowSolution;
Dictionary<string, object> signerPowSolution = new Dictionary<string, object>();
if(tmpSolution != null)
if (Node.blockChain.getLastBlockVersion() >= BlockVer.v10)
{
signerPowSolution.Add("blockNum", tmpSolution.blockNum);
signerPowSolution.Add("solution", tmpSolution.solution);
signerPowSolution.Add("checksum", tmpSolution.checksum);
signerPowSolution.Add("difficulty", tmpSolution.difficulty.ToString());
signerPowSolution.Add("bits", Crypto.hashToString(BitConverter.GetBytes(tmpSolution.bits)));
}
networkArray.Add("Signer Last PoW Solution", signerPowSolution);
networkArray.Add("Signer Difficulty", Node.blockChain.getRequiredSignerDifficulty(Node.blockChain.getLastBlock(), false).ToString());
networkArray.Add("Signer Bits", Crypto.hashToString(BitConverter.GetBytes(Node.blockChain.getRequiredSignerBits())));
networkArray.Add("Signer Hashrate", Node.signerPowMiner.lastHashRate);

tmpSolution = PresenceList.getPowSolution();
signerPowSolution = new Dictionary<string, object>();
if (tmpSolution != null)
{
signerPowSolution.Add("blockNum", tmpSolution.blockNum);
signerPowSolution.Add("solution", tmpSolution.solution);
signerPowSolution.Add("checksum", tmpSolution.checksum);
signerPowSolution.Add("difficulty", tmpSolution.difficulty.ToString());
signerPowSolution.Add("bits", Crypto.hashToString(BitConverter.GetBytes(tmpSolution.bits)));
var tmpSolution = Node.signerPowMiner.lastSignerPowSolution;
Dictionary<string, object> signerPowSolution = new Dictionary<string, object>();
if (tmpSolution != null)
{
signerPowSolution.Add("blockNum", tmpSolution.blockNum);
signerPowSolution.Add("solution", tmpSolution.solution);
signerPowSolution.Add("checksum", tmpSolution.checksum);
signerPowSolution.Add("difficulty", tmpSolution.difficulty.ToString());
signerPowSolution.Add("bits", Crypto.hashToString(BitConverter.GetBytes(tmpSolution.bits)));
}
networkArray.Add("Signer Last PoW Solution", signerPowSolution);

tmpSolution = PresenceList.getPowSolution();
signerPowSolution = new Dictionary<string, object>();
if (tmpSolution != null)
{
signerPowSolution.Add("blockNum", tmpSolution.blockNum);
signerPowSolution.Add("solution", tmpSolution.solution);
signerPowSolution.Add("checksum", tmpSolution.checksum);
signerPowSolution.Add("difficulty", tmpSolution.difficulty.ToString());
signerPowSolution.Add("bits", Crypto.hashToString(BitConverter.GetBytes(tmpSolution.bits)));
}
networkArray.Add("Signer Active PoW Solution", signerPowSolution);
}
networkArray.Add("Signer Active PoW Solution", signerPowSolution);

networkArray.Add("Wallets", Node.walletState.numWallets);
networkArray.Add("Presences", PresenceList.getTotalPresences());
Expand Down

0 comments on commit cd8dd36

Please sign in to comment.