I originally wrote this function and we call it Hush DPoW around here
This commit is contained in:
@@ -145,7 +145,7 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex)
|
||||
// Only report confirmations if the block is on the main chain
|
||||
if (chainActive.Contains(blockindex))
|
||||
confirmations = chainActive.Height() - blockindex->GetHeight() + 1;
|
||||
result.push_back(Pair("confirmations", komodo_dpowconfs(blockindex->GetHeight(),confirmations)));
|
||||
result.push_back(Pair("confirmations", hush_dpowconfs(blockindex->GetHeight(),confirmations)));
|
||||
result.push_back(Pair("rawconfirmations", confirmations));
|
||||
result.push_back(Pair("height", blockindex->GetHeight()));
|
||||
result.push_back(Pair("version", blockindex->nVersion));
|
||||
@@ -178,7 +178,7 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex)
|
||||
} else {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block is an orphan");
|
||||
}
|
||||
result.push_back(Pair("confirmations", komodo_dpowconfs(blockindex->GetHeight(),confirmations)));
|
||||
result.push_back(Pair("confirmations", hush_dpowconfs(blockindex->GetHeight(),confirmations)));
|
||||
result.push_back(Pair("rawconfirmations", confirmations));
|
||||
result.push_back(Pair("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION)));
|
||||
result.push_back(Pair("height", blockindex->GetHeight()));
|
||||
@@ -299,7 +299,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
|
||||
// Only report confirmations if the block is on the main chain
|
||||
if (chainActive.Contains(blockindex))
|
||||
confirmations = chainActive.Height() - blockindex->GetHeight() + 1;
|
||||
result.push_back(Pair("confirmations", komodo_dpowconfs(blockindex->GetHeight(),confirmations)));
|
||||
result.push_back(Pair("confirmations", hush_dpowconfs(blockindex->GetHeight(),confirmations)));
|
||||
result.push_back(Pair("rawconfirmations", confirmations));
|
||||
result.push_back(Pair("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION)));
|
||||
result.push_back(Pair("height", blockindex->GetHeight()));
|
||||
@@ -1489,7 +1489,7 @@ UniValue gettxout(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
ret.push_back(Pair("confirmations", 0));
|
||||
ret.push_back(Pair("rawconfirmations", 0));
|
||||
} else {
|
||||
ret.push_back(Pair("confirmations", komodo_dpowconfs(coins.nHeight,pindex->GetHeight() - coins.nHeight + 1)));
|
||||
ret.push_back(Pair("confirmations", hush_dpowconfs(coins.nHeight,pindex->GetHeight() - coins.nHeight + 1)));
|
||||
ret.push_back(Pair("rawconfirmations", pindex->GetHeight() - coins.nHeight + 1));
|
||||
}
|
||||
ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue)));
|
||||
|
||||
@@ -57,7 +57,7 @@ int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *
|
||||
using namespace std;
|
||||
|
||||
extern char ASSETCHAINS_SYMBOL[];
|
||||
int32_t komodo_dpowconfs(int32_t height,int32_t numconfs);
|
||||
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
|
||||
|
||||
void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex)
|
||||
{
|
||||
@@ -266,7 +266,7 @@ void TxToJSONExpanded(const CTransaction& tx, const uint256 hashBlock, UniValue&
|
||||
|
||||
if (nConfirmations > 0) {
|
||||
entry.push_back(Pair("height", nHeight));
|
||||
entry.push_back(Pair("confirmations", komodo_dpowconfs(nHeight,nConfirmations)));
|
||||
entry.push_back(Pair("confirmations", hush_dpowconfs(nHeight,nConfirmations)));
|
||||
entry.push_back(Pair("rawconfirmations", nConfirmations));
|
||||
entry.push_back(Pair("time", nBlockTime));
|
||||
entry.push_back(Pair("blocktime", nBlockTime));
|
||||
@@ -350,7 +350,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
|
||||
if (chainActive.Contains(pindex)) {
|
||||
entry.push_back(Pair("height", pindex->GetHeight()));
|
||||
entry.push_back(Pair("rawconfirmations", 1 + chainActive.Height() - pindex->GetHeight()));
|
||||
entry.push_back(Pair("confirmations", komodo_dpowconfs(pindex->GetHeight(),1 + chainActive.Height() - pindex->GetHeight())));
|
||||
entry.push_back(Pair("confirmations", hush_dpowconfs(pindex->GetHeight(),1 + chainActive.Height() - pindex->GetHeight())));
|
||||
entry.push_back(Pair("time", pindex->GetBlockTime()));
|
||||
entry.push_back(Pair("blocktime", pindex->GetBlockTime()));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user