Merge branch 'duke' of https://github.com/MyHush/hush3 into duke
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -159,3 +159,6 @@ src/libcc.so
|
|||||||
src/cc/customcc.so
|
src/cc/customcc.so
|
||||||
src/HUSH3_7776
|
src/HUSH3_7776
|
||||||
REGTEST_7776
|
REGTEST_7776
|
||||||
|
src/cc/librogue.so
|
||||||
|
src/cc/games/prices
|
||||||
|
src/cc/games/tetris
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# THIS FILE IS GENERATED FROM run-bitcoind-for-test.sh.in
|
||||||
# Copyright (c) 2013-2014 The Bitcoin Core developers
|
# Copyright (c) 2013-2014 The Bitcoin Core developers
|
||||||
|
# Copyright (c) 2019 The Hush developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
#
|
#
|
||||||
ZCASH_LOAD_TIMEOUT=500
|
HUSH_LOAD_TIMEOUT=500
|
||||||
DATADIR="@abs_top_builddir@/.zcash"
|
DATADIR="@abs_top_builddir@/.komodo/HUSH3"
|
||||||
rm -rf "$DATADIR"
|
rm -rf "$DATADIR"
|
||||||
mkdir -p "$DATADIR"/regtest
|
mkdir -p "$DATADIR"/regtest
|
||||||
touch "$DATADIR/zcash.conf"
|
touch "$DATADIR/HUSH3.conf"
|
||||||
touch "$DATADIR/regtest/debug.log"
|
touch "$DATADIR/regtest/debug.log"
|
||||||
tail -q -n 1 -F "$DATADIR/regtest/debug.log" | grep -m 1 -q "Done loading" &
|
tail -q -n 1 -F "$DATADIR/regtest/debug.log" | grep -m 1 -q "Done loading" &
|
||||||
WAITER=$!
|
WAITER=$!
|
||||||
PORT=`expr 10000 + $$ % 55536`
|
PORT=`expr 10000 + $$ % 55536`
|
||||||
"@abs_top_builddir@/src/zcashd@EXEEXT@" -connect=0.0.0.0 -datadir="$DATADIR" -rpcuser=user -rpcpassword=pass -listen -keypool=3 -debug -debug=net -logtimestamps -checkmempool=0 -relaypriority=0 -port=$PORT -whitelist=127.0.0.1 -regtest -rpcport=`expr $PORT + 1` &
|
"@abs_top_builddir@/src/hushd@EXEEXT@" -connect=0.0.0.0 -datadir="$DATADIR" -rpcuser=user -rpcpassword=pass -listen -keypool=3 -debug -debug=net -logtimestamps -checkmempool=0 -relaypriority=0 -port=$PORT -whitelist=127.0.0.1 -regtest -rpcport=`expr $PORT + 1` &
|
||||||
BITCOIND=$!
|
BITCOIND=$!
|
||||||
|
|
||||||
#Install a watchdog.
|
#Install a watchdog.
|
||||||
(sleep "$ZCASH_LOAD_TIMEOUT" && kill -0 $WAITER 2>/dev/null && kill -9 $BITCOIND $$)&
|
(sleep "$HUSH_LOAD_TIMEOUT" && kill -0 $WAITER 2>/dev/null && kill -9 $BITCOIND $$)&
|
||||||
wait $WAITER
|
wait $WAITER
|
||||||
|
|
||||||
if [ -n "$TIMEOUT" ]; then
|
if [ -n "$TIMEOUT" ]; then
|
||||||
@@ -27,7 +29,7 @@ else
|
|||||||
RETURN=$?
|
RETURN=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(sleep "$ZCASH_LOAD_TIMEOUT" && kill -0 $BITCOIND 2>/dev/null && kill -9 $BITCOIND $$)&
|
(sleep "$HUSH_LOAD_TIMEOUT" && kill -0 $BITCOIND 2>/dev/null && kill -9 $BITCOIND $$)&
|
||||||
kill $BITCOIND && wait $BITCOIND
|
kill $BITCOIND && wait $BITCOIND
|
||||||
|
|
||||||
# timeout returns 124 on timeout, otherwise the return value of the child
|
# timeout returns 124 on timeout, otherwise the return value of the child
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# THIS FILE IS GENERATED FROM tests-config.sh.in
|
||||||
# Copyright (c) 2013-2014 The Bitcoin Core developers
|
# Copyright (c) 2013-2014 The Bitcoin Core developers
|
||||||
|
# Copyright (c) 2019 The Hush developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
@@ -13,6 +15,6 @@ EXEEXT="@EXEEXT@"
|
|||||||
@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=1
|
@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=1
|
||||||
@ENABLE_PROTON_TRUE@ENABLE_PROTON=1
|
@ENABLE_PROTON_TRUE@ENABLE_PROTON=1
|
||||||
|
|
||||||
REAL_BITCOIND="$BUILDDIR/src/komodod${EXEEXT}"
|
REAL_BITCOIND="$BUILDDIR/src/hushd${EXEEXT}"
|
||||||
REAL_BITCOINCLI="$BUILDDIR/src/komodo-cli${EXEEXT}"
|
REAL_BITCOINCLI="$BUILDDIR/src/hush-cli${EXEEXT}"
|
||||||
|
|
||||||
|
|||||||
133
src/chain.h
133
src/chain.h
@@ -138,6 +138,7 @@ class CBlockIndex;
|
|||||||
// that involves mining in secret completely ineffective, even before dPOW, unless a large part
|
// that involves mining in secret completely ineffective, even before dPOW, unless a large part
|
||||||
// of the staking supply is also controlled. It also enables a faster deterministic convergence,
|
// of the staking supply is also controlled. It also enables a faster deterministic convergence,
|
||||||
// aided by both POS and POW.
|
// aided by both POS and POW.
|
||||||
|
// TODO: delete this junk
|
||||||
class CChainPower
|
class CChainPower
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -256,17 +257,105 @@ public:
|
|||||||
//! (memory only) Total amount of work (expected number of hashes) in the chain up to and including this block
|
//! (memory only) Total amount of work (expected number of hashes) in the chain up to and including this block
|
||||||
CChainPower chainPower;
|
CChainPower chainPower;
|
||||||
|
|
||||||
// block stats
|
|
||||||
//! Number of transactions in this block.
|
//! Number of transactions in this block.
|
||||||
//! Note: in a potential headers-first mode, this number cannot be relied upon
|
//! Note: in a potential headers-first mode, this number cannot be relied upon
|
||||||
unsigned int nTx;
|
unsigned int nTx;
|
||||||
|
|
||||||
// chain stats
|
//! Number of notarization transactions in this block.
|
||||||
|
int64_t nNotarizations;
|
||||||
|
|
||||||
|
//! (memory only) Number of payments (shielded or transparent) in the block
|
||||||
|
//! up to and including this block. One transaction can contain one or more
|
||||||
|
//! payments. This stat allows us to calculate ratios of shielded/transparent
|
||||||
|
//! when combined with shielded payment stats
|
||||||
|
int64_t nPayments;
|
||||||
|
|
||||||
|
//! (memory only) Number of shielded transactions (of any kind) in the block up to and including this block.
|
||||||
|
//! A shielded transaction is defined as a transaction that contains at least 1 JoinSplit, which includes
|
||||||
|
//! shielding/de-shielding and other complex transaction possibilties including multiple taddrs/zaddrs as
|
||||||
|
//! inputs and outputs.
|
||||||
|
int64_t nShieldedTx;
|
||||||
|
|
||||||
|
//! (memory only) Number of fully shielded transactions. A fully shielded transaction is defined
|
||||||
|
//! as a transaction containing JoinSplits and only shielded inputs and outputs, i.e. no transparent
|
||||||
|
// inputs or outputs: z->z or z->(z,z) or z->(z,z,z,) etc...
|
||||||
|
int64_t nFullyShieldedTx;
|
||||||
|
|
||||||
|
//! (memory only) Number of shielding payments. A shielding payment is defined
|
||||||
|
//! as having a shielded output but transparent input: t->z
|
||||||
|
int64_t nShieldingPayments;
|
||||||
|
|
||||||
|
//! (memory only) Number of shielded payments. A shielded payment is defined
|
||||||
|
//! as having a shielded input or output: t->z or z->t
|
||||||
|
int64_t nShieldedPayments;
|
||||||
|
|
||||||
|
//! (memory only) Number of fully shielded payments. A fully shielded payment is defined
|
||||||
|
//! as having a shielded input and shielded output: z->z
|
||||||
|
int64_t nFullyShieldedPayments;
|
||||||
|
|
||||||
|
//! (memory only) Number of deshielding transactions. A deshielding transaction is defined
|
||||||
|
//! as a transaction containing JoinSplits and at least one transparent output.
|
||||||
|
int64_t nDeshieldingTx;
|
||||||
|
|
||||||
|
//! (memory only) Number of deshielding payments. A deshielding payment is defined
|
||||||
|
//! as one transparent input and one shielded output: z->t
|
||||||
|
int64_t nDeshieldingPayments;
|
||||||
|
|
||||||
|
//! (memory only) Number of shielding transactions. A shielding transaction is defined
|
||||||
|
//! as a transaction containing JoinSplits and at least one transparent input
|
||||||
|
// i.e. t->z or t->(z,t) or z->(z,z,t)
|
||||||
|
int64_t nShieldingTx;
|
||||||
|
|
||||||
//! (memory only) Number of transactions in the chain up to and including this block.
|
//! (memory only) Number of transactions in the chain up to and including this block.
|
||||||
//! This value will be non-zero only if and only if transactions for this block and all its parents are available.
|
//! This value will be non-zero only if and only if transactions for this block and all its parents are available.
|
||||||
//! Change to 64-bit type when necessary; won't happen before 2030
|
//! Change to 64-bit type when necessary; won't happen before 2030
|
||||||
unsigned int nChainTx;
|
unsigned int nChainTx;
|
||||||
|
|
||||||
|
//! Number of notarization transactions in this chain
|
||||||
|
int64_t nChainNotarizations;
|
||||||
|
|
||||||
|
//! (memory only) Number of payments (shielded or transparent) in the chain
|
||||||
|
//! up to and including this block. One transaction can contain one or more
|
||||||
|
//! payments. This stat allows us to calculate ratios of shielded/transparent
|
||||||
|
//! when combined with shielded payment stats
|
||||||
|
int64_t nChainPayments;
|
||||||
|
|
||||||
|
//! (memory only) Number of shielded transactions (of any kind) in the chain up to and including this block.
|
||||||
|
//! A shielded transaction is defined as a transaction that contains at least 1 JoinSplit, which includes
|
||||||
|
//! shielding/de-shielding and other complex transaction possibilties including multiple taddrs/zaddrs as
|
||||||
|
//! inputs and outputs.
|
||||||
|
int64_t nChainShieldedTx;
|
||||||
|
|
||||||
|
//! (memory only) Number of fully shielded transactions. A fully shielded transaction is defined
|
||||||
|
//! as a transaction containing JoinSplits and only shielded inputs and outputs, i.e. no transparent
|
||||||
|
// inputs or outputs: z->z or z->(z,z) or z->(z,z,z,) etc...
|
||||||
|
int64_t nChainFullyShieldedTx;
|
||||||
|
|
||||||
|
//! (memory only) Number of shielding payments. A shielding payment is defined
|
||||||
|
//! as having a shielded output but transparent input: t->z
|
||||||
|
int64_t nChainShieldingPayments;
|
||||||
|
|
||||||
|
//! (memory only) Number of shielded payments. A shielded payment is defined
|
||||||
|
//! as having a shielded input or output: t->z or z->t
|
||||||
|
int64_t nChainShieldedPayments;
|
||||||
|
|
||||||
|
//! (memory only) Number of fully shielded payments. A fully shielded payment is defined
|
||||||
|
//! as having a shielded input and shielded output: z->z
|
||||||
|
int64_t nChainFullyShieldedPayments;
|
||||||
|
|
||||||
|
//! (memory only) Number of deshielding transactions. A deshielding transaction is defined
|
||||||
|
//! as a transaction containing JoinSplits and at least one transparent output.
|
||||||
|
int64_t nChainDeshieldingTx;
|
||||||
|
|
||||||
|
//! (memory only) Number of deshielding payments. A deshielding payment is defined
|
||||||
|
//! as one transparent input and one shielded output: z->t
|
||||||
|
int64_t nChainDeshieldingPayments;
|
||||||
|
|
||||||
|
//! (memory only) Number of shielding transactions. A shielding transaction is defined
|
||||||
|
//! as a transaction containing JoinSplits and at least one transparent input
|
||||||
|
// i.e. t->z or t->(z,t) or z->(z,z,t)
|
||||||
|
int64_t nChainShieldingTx;
|
||||||
|
|
||||||
//! Verification status of this block. See enum BlockStatus
|
//! Verification status of this block. See enum BlockStatus
|
||||||
unsigned int nStatus;
|
unsigned int nStatus;
|
||||||
|
|
||||||
@@ -326,6 +415,28 @@ public:
|
|||||||
nTx = 0;
|
nTx = 0;
|
||||||
nChainTx = 0;
|
nChainTx = 0;
|
||||||
|
|
||||||
|
nChainPayments = 0;
|
||||||
|
nChainShieldedTx = 0;
|
||||||
|
nChainShieldingTx = 0;
|
||||||
|
nChainDeshieldingTx = 0;
|
||||||
|
nChainNotarizations = 0;
|
||||||
|
nChainFullyShieldedTx = 0;
|
||||||
|
nChainShieldedPayments = 0;
|
||||||
|
nChainShieldingPayments = 0;
|
||||||
|
nChainDeshieldingPayments = 0;
|
||||||
|
nChainFullyShieldedPayments = 0;
|
||||||
|
|
||||||
|
nPayments = 0;
|
||||||
|
nShieldedTx = 0;
|
||||||
|
nShieldingTx = 0;
|
||||||
|
nNotarizations = 0;
|
||||||
|
nDeshieldingTx = 0;
|
||||||
|
nFullyShieldedTx = 0;
|
||||||
|
nShieldedPayments = 0;
|
||||||
|
nShieldingPayments = 0;
|
||||||
|
nDeshieldingPayments = 0;
|
||||||
|
nFullyShieldedPayments = 0;
|
||||||
|
|
||||||
nStatus = 0;
|
nStatus = 0;
|
||||||
nCachedBranchId = boost::none;
|
nCachedBranchId = boost::none;
|
||||||
hashSproutAnchor = uint256();
|
hashSproutAnchor = uint256();
|
||||||
@@ -501,6 +612,7 @@ public:
|
|||||||
READWRITE(VARINT(nStatus));
|
READWRITE(VARINT(nStatus));
|
||||||
READWRITE(VARINT(nTx));
|
READWRITE(VARINT(nTx));
|
||||||
|
|
||||||
|
|
||||||
if (nStatus & (BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO))
|
if (nStatus & (BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO))
|
||||||
READWRITE(VARINT(nFile));
|
READWRITE(VARINT(nFile));
|
||||||
if (nStatus & BLOCK_HAVE_DATA)
|
if (nStatus & BLOCK_HAVE_DATA)
|
||||||
@@ -542,10 +654,27 @@ public:
|
|||||||
if ((s.GetType() & SER_DISK) && (nVersion >= SAPLING_VALUE_VERSION)) {
|
if ((s.GetType() & SER_DISK) && (nVersion >= SAPLING_VALUE_VERSION)) {
|
||||||
READWRITE(nSaplingValue);
|
READWRITE(nSaplingValue);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if ( (s.GetType() & SER_DISK) && (is_STAKED(ASSETCHAINS_SYMBOL) != 0) && ASSETCHAINS_NOTARY_PAY[0] != 0 )
|
if ( (s.GetType() & SER_DISK) && (is_STAKED(ASSETCHAINS_SYMBOL) != 0) && ASSETCHAINS_NOTARY_PAY[0] != 0 )
|
||||||
{
|
{
|
||||||
READWRITE(nNotaryPay);
|
READWRITE(nNotaryPay);
|
||||||
READWRITE(segid);
|
READWRITE(segid);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// These values only serialized when -zindex enabled
|
||||||
|
if((s.GetType() & SER_DISK) && fZindex) {
|
||||||
|
READWRITE(nShieldedTx);
|
||||||
|
READWRITE(nShieldingTx);
|
||||||
|
READWRITE(nDeshieldingTx);
|
||||||
|
READWRITE(nFullyShieldedTx);
|
||||||
|
|
||||||
|
READWRITE(nPayments);
|
||||||
|
READWRITE(nNotarizations);
|
||||||
|
READWRITE(nShieldedPayments);
|
||||||
|
READWRITE(nShieldingPayments);
|
||||||
|
READWRITE(nDeshieldingPayments);
|
||||||
|
READWRITE(nFullyShieldedPayments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Copyright (c) 2012-2014 The Bitcoin Core developers
|
// Copyright (c) 2012-2014 The Bitcoin Core developers
|
||||||
|
// Copyright (c) 2019 The Hush developers
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
@@ -143,6 +144,7 @@ public:
|
|||||||
CDataStream ssValue(slValue.data(), slValue.data() + slValue.size(), SER_DISK, CLIENT_VERSION);
|
CDataStream ssValue(slValue.data(), slValue.data() + slValue.size(), SER_DISK, CLIENT_VERSION);
|
||||||
ssValue >> value;
|
ssValue >> value;
|
||||||
} catch(std::exception &e) {
|
} catch(std::exception &e) {
|
||||||
|
LogPrintf("%s: CDataStream error - %s\n", __FUNCTION__, e.what());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -207,7 +209,8 @@ public:
|
|||||||
try {
|
try {
|
||||||
CDataStream ssValue(strValue.data(), strValue.data() + strValue.size(), SER_DISK, CLIENT_VERSION);
|
CDataStream ssValue(strValue.data(), strValue.data() + strValue.size(), SER_DISK, CLIENT_VERSION);
|
||||||
ssValue >> value;
|
ssValue >> value;
|
||||||
} catch (const std::exception&) {
|
} catch (const std::exception &e) {
|
||||||
|
LogPrintf("%s: CDataStream error - %s\n", __FUNCTION__, e.what());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
11
src/init.cpp
11
src/init.cpp
@@ -1755,11 +1755,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
boost::filesystem::remove(GetDataDir() / "komodostate");
|
boost::filesystem::remove(GetDataDir() / "komodostate");
|
||||||
boost::filesystem::remove(GetDataDir() / "signedmasks");
|
boost::filesystem::remove(GetDataDir() / "signedmasks");
|
||||||
pblocktree->WriteReindexing(true);
|
pblocktree->WriteReindexing(true);
|
||||||
|
fprintf(stderr, "%s: Deleted komodostate and signedmasks...\n", __FUNCTION__);
|
||||||
|
|
||||||
//If we're reindexing in prune mode, wipe away unusable block files and all undo data files
|
//If we're reindexing in prune mode, wipe away unusable block files and all undo data files
|
||||||
if (fPruneMode)
|
if (fPruneMode)
|
||||||
CleanupBlockRevFiles();
|
CleanupBlockRevFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "%s: Loading block index...\n", __FUNCTION__);
|
||||||
if (!LoadBlockIndex()) {
|
if (!LoadBlockIndex()) {
|
||||||
strLoadError = _("Error loading block database");
|
strLoadError = _("Error loading block database");
|
||||||
break;
|
break;
|
||||||
@@ -1819,14 +1822,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
}
|
}
|
||||||
if ( KOMODO_REWIND == 0 )
|
if ( KOMODO_REWIND == 0 )
|
||||||
{
|
{
|
||||||
if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", 3),
|
LogPrintf("Verifying block DB...");
|
||||||
GetArg("-checkblocks", 288))) {
|
if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", 3), GetArg("-checkblocks", 288))) {
|
||||||
strLoadError = _("Corrupted block database detected");
|
strLoadError = _("Corrupted block database detected");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
if (fDebug) LogPrintf("%s\n", e.what());
|
LogPrintf("%s: Error opening block database: %s\n", __FUNCTION__, e.what());
|
||||||
strLoadError = _("Error opening block database");
|
strLoadError = _("Error opening block database");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1837,7 +1840,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
if (!fLoaded) {
|
if (!fLoaded) {
|
||||||
// first suggest a reindex
|
// first suggest a reindex
|
||||||
if (!fReset) {
|
if (!fReset) {
|
||||||
fprintf(stderr,"%s error in hd data\n", __FUNCTION__);
|
fprintf(stderr,"%s: error in hd data\n", __FUNCTION__);
|
||||||
bool fRet = uiInterface.ThreadSafeMessageBox(
|
bool fRet = uiInterface.ThreadSafeMessageBox(
|
||||||
strLoadError + ".\n\n" + _("error in HDD data, might just need to update to latest, if that doesnt work, then you need to resync"),
|
strLoadError + ".\n\n" + _("error in HDD data, might just need to update to latest, if that doesnt work, then you need to resync"),
|
||||||
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT);
|
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT);
|
||||||
|
|||||||
147
src/main.cpp
147
src/main.cpp
@@ -4717,6 +4717,10 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
|
|||||||
CAmount sproutValue = 0;
|
CAmount sproutValue = 0;
|
||||||
CAmount saplingValue = 0;
|
CAmount saplingValue = 0;
|
||||||
bool isShieldedTx = false;
|
bool isShieldedTx = false;
|
||||||
|
unsigned int nShieldedSpends=0,nShieldedOutputs=0,nPayments=0;
|
||||||
|
unsigned int nShieldedTx=0,nFullyShieldedTx=0,nDeshieldingTx=0,nShieldingTx=0;
|
||||||
|
unsigned int nShieldedPayments=0,nFullyShieldedPayments=0,nShieldingPayments=0,nDeshieldingPayments=0;
|
||||||
|
unsigned int nNotarizations=0;
|
||||||
|
|
||||||
for (auto tx : block.vtx) {
|
for (auto tx : block.vtx) {
|
||||||
// Negative valueBalance "takes" money from the transparent value pool
|
// Negative valueBalance "takes" money from the transparent value pool
|
||||||
@@ -4729,6 +4733,78 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
|
|||||||
sproutValue += js.vpub_old;
|
sproutValue += js.vpub_old;
|
||||||
sproutValue -= js.vpub_new;
|
sproutValue -= js.vpub_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ignore following stats unless -zindex enabled
|
||||||
|
if (!fZindex)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
nShieldedSpends = tx.vShieldedSpend.size();
|
||||||
|
nShieldedOutputs = tx.vShieldedOutput.size();
|
||||||
|
isShieldedTx = (nShieldedSpends + nShieldedOutputs) > 0 ? true : false;
|
||||||
|
|
||||||
|
// We want to avoid full verification with a low false-positive rate
|
||||||
|
// TODO: A nefarious user could create xtns which meet these criteria and skew stats, what
|
||||||
|
// else can we look for which is not full validation?
|
||||||
|
// Can we filter on properties of tx.vout[0] ?
|
||||||
|
if(tx.vin.size()==13 && tx.vout.size()==2 && tx.vout[1].scriptPubKey.IsOpReturn() && tx.vout[1].nValue==0) {
|
||||||
|
nNotarizations++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//NOTE: These are at best heuristics. Improve them as much as possible.
|
||||||
|
// You cannot compare stats generated from different sets of heuristics, so
|
||||||
|
// if you change this code, you must reindex or delete datadir + resync from scratch, or you
|
||||||
|
// will be mixing together data from two set of heuristics.
|
||||||
|
if(isShieldedTx) {
|
||||||
|
nShieldedTx++;
|
||||||
|
// NOTE: It's possible for very complex transactions to be both shielding and deshielding,
|
||||||
|
// such as (t,z)=>(t,z) Since these transactions cannot be made via RPCs currently, they
|
||||||
|
// would currently need to be made via raw transactions
|
||||||
|
if(tx.vin.size()==0 && tx.vout.size()==0) {
|
||||||
|
nFullyShieldedTx++;
|
||||||
|
} else if(tx.vin.size()>0) {
|
||||||
|
nShieldingTx++;
|
||||||
|
} else if(tx.vout.size()>0) {
|
||||||
|
nDeshieldingTx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nShieldedOutputs >= 1) {
|
||||||
|
// If there are shielded outputs, count each as a payment
|
||||||
|
// By default, if there is more than 1 output, we assume 1 zaddr change output which is not a payment.
|
||||||
|
// In the case of multiple outputs which spend inputs exactly, there is no change output and this
|
||||||
|
// heuristic will undercount payments. Since this edge case is rare, this seems acceptable.
|
||||||
|
// t->(t,t,z) = 1 shielded payment
|
||||||
|
// z->(z,z) = 1 shielded payment + shielded change
|
||||||
|
// t->(z,z) = 1 shielded payment + shielded change
|
||||||
|
// t->(t,z) = 1 shielded payment + transparent change
|
||||||
|
// (z,z)->z = 1 shielded payment (has this xtn ever occurred?)
|
||||||
|
// z->(z,z,z) = 2 shielded payments + shielded change
|
||||||
|
// Assume that there is always 1 change output when there are more than one output
|
||||||
|
nShieldedPayments += nShieldedOutputs > 1 ? (nShieldedOutputs-1) : 1;
|
||||||
|
// since we have at least 1 zoutput, all transparent outputs are payments, not change
|
||||||
|
nShieldedPayments += tx.vout.size();
|
||||||
|
|
||||||
|
// Fully shielded do not count toward shielding/deshielding
|
||||||
|
if(tx.vin.size()==0 && tx.vout.size()==0) {
|
||||||
|
nFullyShieldedPayments += nShieldedOutputs > 1 ? (nShieldedOutputs-1) : 1;
|
||||||
|
} else {
|
||||||
|
nShieldingPayments += nShieldedOutputs > 1 ? (nShieldedOutputs-1) : 1;
|
||||||
|
// Also count remaining taddr outputs as payments
|
||||||
|
nShieldedPayments += tx.vout.size();
|
||||||
|
}
|
||||||
|
} else if (nShieldedSpends >=1) {
|
||||||
|
// Shielded inputs with no shielded outputs. We know none are change output because
|
||||||
|
// change would flow back to the zaddr
|
||||||
|
// z->t = 1 shielded payment
|
||||||
|
// z->(t,t) = 2 shielded payments
|
||||||
|
// z->(t,t,t) = 3 shielded payments
|
||||||
|
nShieldedPayments += tx.vout.size();
|
||||||
|
nDeshieldingPayments += tx.vout.size() > 1 ? tx.vout.size()-1 : tx.vout.size();
|
||||||
|
}
|
||||||
|
nPayments += nShieldedPayments;
|
||||||
|
} else {
|
||||||
|
// No shielded payments, add transparent payments minus a change address
|
||||||
|
nPayments += tx.vout.size() > 1 ? tx.vout.size()-1 : tx.vout.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pindexNew->nSproutValue = sproutValue;
|
pindexNew->nSproutValue = sproutValue;
|
||||||
pindexNew->nChainSproutValue = boost::none;
|
pindexNew->nChainSproutValue = boost::none;
|
||||||
@@ -4739,6 +4815,19 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
|
|||||||
pindexNew->nUndoPos = 0;
|
pindexNew->nUndoPos = 0;
|
||||||
pindexNew->nStatus |= BLOCK_HAVE_DATA;
|
pindexNew->nStatus |= BLOCK_HAVE_DATA;
|
||||||
pindexNew->RaiseValidity(BLOCK_VALID_TRANSACTIONS);
|
pindexNew->RaiseValidity(BLOCK_VALID_TRANSACTIONS);
|
||||||
|
|
||||||
|
if (fZindex) {
|
||||||
|
pindexNew->nPayments = nPayments;
|
||||||
|
pindexNew->nShieldedTx = nShieldedTx;
|
||||||
|
pindexNew->nFullyShieldedTx = nFullyShieldedTx;
|
||||||
|
pindexNew->nDeshieldingTx = nDeshieldingTx;
|
||||||
|
pindexNew->nShieldingTx = nShieldingTx;
|
||||||
|
pindexNew->nShieldedPayments = nShieldedPayments;
|
||||||
|
pindexNew->nFullyShieldedPayments = nFullyShieldedPayments;
|
||||||
|
pindexNew->nDeshieldingPayments = nDeshieldingPayments;
|
||||||
|
pindexNew->nShieldingPayments = nShieldingPayments;
|
||||||
|
pindexNew->nNotarizations = nNotarizations;
|
||||||
|
}
|
||||||
setDirtyBlockIndex.insert(pindexNew);
|
setDirtyBlockIndex.insert(pindexNew);
|
||||||
|
|
||||||
if (pindexNew->pprev == NULL || pindexNew->pprev->nChainTx) {
|
if (pindexNew->pprev == NULL || pindexNew->pprev->nChainTx) {
|
||||||
@@ -4751,6 +4840,22 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
|
|||||||
CBlockIndex *pindex = queue.front();
|
CBlockIndex *pindex = queue.front();
|
||||||
queue.pop_front();
|
queue.pop_front();
|
||||||
pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx;
|
pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx;
|
||||||
|
|
||||||
|
if (fZindex) {
|
||||||
|
//fprintf(stderr,"%s: setting chain zstats\n", __FUNCTION__);
|
||||||
|
pindex->nChainNotarizations = (pindex->pprev ? pindex->pprev->nChainNotarizations : 0) + pindex->nNotarizations;
|
||||||
|
pindex->nChainShieldedTx = (pindex->pprev ? pindex->pprev->nChainShieldedTx : 0) + pindex->nShieldedTx;
|
||||||
|
pindex->nChainFullyShieldedTx = (pindex->pprev ? pindex->pprev->nChainFullyShieldedTx : 0) + pindex->nFullyShieldedTx;
|
||||||
|
pindex->nChainShieldingTx = (pindex->pprev ? pindex->pprev->nChainShieldingTx : 0) + pindex->nShieldingTx;
|
||||||
|
pindex->nChainDeshieldingTx = (pindex->pprev ? pindex->pprev->nChainDeshieldingTx : 0) + pindex->nDeshieldingTx;
|
||||||
|
|
||||||
|
pindex->nChainPayments = (pindex->pprev ? pindex->pprev->nChainPayments : 0) + pindex->nPayments;
|
||||||
|
pindex->nChainShieldedPayments = (pindex->pprev ? pindex->pprev->nChainShieldedPayments : 0) + pindex->nShieldedPayments;
|
||||||
|
pindex->nChainFullyShieldedPayments = (pindex->pprev ? pindex->pprev->nChainFullyShieldedPayments : 0) + pindex->nFullyShieldedPayments;
|
||||||
|
pindex->nChainShieldingPayments = (pindex->pprev ? pindex->pprev->nChainShieldingPayments : 0) + pindex->nShieldingPayments;
|
||||||
|
pindex->nChainDeshieldingPayments = (pindex->pprev ? pindex->pprev->nChainDeshieldingPayments : 0) + pindex->nDeshieldingPayments;
|
||||||
|
}
|
||||||
|
|
||||||
if (pindex->pprev) {
|
if (pindex->pprev) {
|
||||||
if (pindex->pprev->nChainSproutValue && pindex->nSproutValue) {
|
if (pindex->pprev->nChainSproutValue && pindex->nSproutValue) {
|
||||||
pindex->nChainSproutValue = *pindex->pprev->nChainSproutValue + *pindex->nSproutValue;
|
pindex->nChainSproutValue = *pindex->pprev->nChainSproutValue + *pindex->nSproutValue;
|
||||||
@@ -4787,6 +4892,9 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fZindex)
|
||||||
|
fprintf(stderr, "ht.%d, ShieldedPayments=%d, ShieldedTx=%d, FullyShieldedTx=%d, ntz=%d\n", pindexNew->GetHeight(), nShieldedPayments, nShieldedTx, nFullyShieldedTx, nNotarizations );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6035,6 +6143,20 @@ bool static LoadBlockIndexDB()
|
|||||||
if (pindex->pprev) {
|
if (pindex->pprev) {
|
||||||
if (pindex->pprev->nChainTx) {
|
if (pindex->pprev->nChainTx) {
|
||||||
pindex->nChainTx = pindex->pprev->nChainTx + pindex->nTx;
|
pindex->nChainTx = pindex->pprev->nChainTx + pindex->nTx;
|
||||||
|
if (fZindex) {
|
||||||
|
pindex->nChainNotarizations = pindex->pprev->nChainNotarizations + pindex->nNotarizations;
|
||||||
|
pindex->nChainShieldedTx = pindex->pprev->nChainShieldedTx + pindex->nShieldedTx;
|
||||||
|
pindex->nChainShieldedPayments = pindex->pprev->nChainShieldedPayments + pindex->nShieldedPayments;
|
||||||
|
pindex->nChainShieldingTx = pindex->pprev->nChainShieldingTx + pindex->nShieldingTx;
|
||||||
|
|
||||||
|
pindex->nChainPayments = pindex->pprev->nChainPayments + pindex->nPayments;
|
||||||
|
pindex->nChainShieldingPayments = pindex->pprev->nChainShieldingPayments + pindex->nShieldingPayments;
|
||||||
|
pindex->nChainDeshieldingTx = pindex->pprev->nChainShieldedTx + pindex->nShieldedTx;
|
||||||
|
pindex->nChainDeshieldingPayments = pindex->pprev->nChainShieldedPayments + pindex->nShieldedPayments;
|
||||||
|
pindex->nChainFullyShieldedTx = pindex->pprev->nChainFullyShieldedTx + pindex->nFullyShieldedTx;
|
||||||
|
pindex->nChainFullyShieldedPayments = pindex->pprev->nChainFullyShieldedPayments + pindex->nFullyShieldedPayments;
|
||||||
|
}
|
||||||
|
|
||||||
if (pindex->pprev->nChainSproutValue && pindex->nSproutValue) {
|
if (pindex->pprev->nChainSproutValue && pindex->nSproutValue) {
|
||||||
pindex->nChainSproutValue = *pindex->pprev->nChainSproutValue + *pindex->nSproutValue;
|
pindex->nChainSproutValue = *pindex->pprev->nChainSproutValue + *pindex->nSproutValue;
|
||||||
} else {
|
} else {
|
||||||
@@ -6047,6 +6169,18 @@ bool static LoadBlockIndexDB()
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pindex->nChainTx = 0;
|
pindex->nChainTx = 0;
|
||||||
|
if (fZindex) {
|
||||||
|
pindex->nChainPayments = 0;
|
||||||
|
pindex->nChainNotarizations = 0;
|
||||||
|
pindex->nChainShieldedTx = 0;
|
||||||
|
pindex->nChainFullyShieldedTx = 0;
|
||||||
|
pindex->nChainShieldedPayments = 0;
|
||||||
|
pindex->nChainShieldingPayments = 0;
|
||||||
|
pindex->nChainDeshieldingTx = 0;
|
||||||
|
pindex->nChainDeshieldingPayments = 0;
|
||||||
|
pindex->nChainFullyShieldedTx = 0;
|
||||||
|
pindex->nChainFullyShieldedPayments = 0;
|
||||||
|
}
|
||||||
pindex->nChainSproutValue = boost::none;
|
pindex->nChainSproutValue = boost::none;
|
||||||
pindex->nChainSaplingValue = boost::none;
|
pindex->nChainSaplingValue = boost::none;
|
||||||
mapBlocksUnlinked.insert(std::make_pair(pindex->pprev, pindex));
|
mapBlocksUnlinked.insert(std::make_pair(pindex->pprev, pindex));
|
||||||
@@ -6055,6 +6189,17 @@ bool static LoadBlockIndexDB()
|
|||||||
pindex->nChainTx = pindex->nTx;
|
pindex->nChainTx = pindex->nTx;
|
||||||
pindex->nChainSproutValue = pindex->nSproutValue;
|
pindex->nChainSproutValue = pindex->nSproutValue;
|
||||||
pindex->nChainSaplingValue = pindex->nSaplingValue;
|
pindex->nChainSaplingValue = pindex->nSaplingValue;
|
||||||
|
if (fZindex) {
|
||||||
|
pindex->nChainPayments = pindex->nPayments;
|
||||||
|
pindex->nChainNotarizations = pindex->nNotarizations;
|
||||||
|
pindex->nChainShieldedTx = pindex->nShieldedTx;
|
||||||
|
pindex->nChainShieldedPayments = pindex->nShieldedPayments;
|
||||||
|
pindex->nChainShieldingTx = pindex->nShieldingTx;
|
||||||
|
pindex->nChainShieldingPayments = pindex->nShieldingPayments;
|
||||||
|
pindex->nChainDeshieldingTx = pindex->nDeshieldingTx;
|
||||||
|
pindex->nChainDeshieldingPayments = pindex->nDeshieldingPayments;
|
||||||
|
pindex->nChainFullyShieldedPayments = pindex->nFullyShieldedPayments;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Construct in-memory chain of branch IDs.
|
// Construct in-memory chain of branch IDs.
|
||||||
@@ -6110,7 +6255,7 @@ bool static LoadBlockIndexDB()
|
|||||||
setBlkDataFiles.insert(pindex->nFile);
|
setBlkDataFiles.insert(pindex->nFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//fprintf(stderr,"load blockindexDB %u\n",(uint32_t)time(NULL));
|
fprintf(stderr,"load blockindexDB %u\n",(uint32_t)time(NULL));
|
||||||
for (std::set<int>::iterator it = setBlkDataFiles.begin(); it != setBlkDataFiles.end(); it++)
|
for (std::set<int>::iterator it = setBlkDataFiles.begin(); it != setBlkDataFiles.end(); it++)
|
||||||
{
|
{
|
||||||
CDiskBlockPos pos(*it, 0);
|
CDiskBlockPos pos(*it, 0);
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
#include "uint256.h"
|
#include "uint256.h"
|
||||||
#include "arith_uint256.h"
|
#include "arith_uint256.h"
|
||||||
|
|
||||||
extern int32_t ASSETCHAINS_LWMAPOS;
|
|
||||||
|
|
||||||
/** Nodes collect new transactions into a block, hash them into a hash tree,
|
/** Nodes collect new transactions into a block, hash them into a hash tree,
|
||||||
* and scan through nonce values to make the block's hash satisfy proof-of-work
|
* and scan through nonce values to make the block's hash satisfy proof-of-work
|
||||||
* requirements. When they solve the proof-of-work, they broadcast the block
|
* requirements. When they solve the proof-of-work, they broadcast the block
|
||||||
|
|||||||
@@ -1874,24 +1874,69 @@ inline CBlockIndex* LookupBlockIndex(const uint256& hash)
|
|||||||
return it == mapBlockIndex.end() ? nullptr : it->second;
|
return it == mapBlockIndex.end() ? nullptr : it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// given a transaction count X, subtract out coinbase and dpow transactions
|
||||||
|
// to give an "organic count". We return 0 instead of negative values
|
||||||
|
#define ORG(X) ( (X - blockcount - nNotarizationsDiff) > 0 ? (X - blockcount - nNotarizationsDiff) : 0 )
|
||||||
|
|
||||||
|
//TODO: Allow custom error message in this macro
|
||||||
|
#define THROW_IF_SYNCING(INSYNC) if (INSYNC == 0) { throw runtime_error(strprintf("%s: Chain still syncing at height %d, aborting to prevent garbage data. Please wait until the chain is synced to run this RPC",__FUNCTION__,chainActive.Tip()->GetHeight())); }
|
||||||
|
|
||||||
UniValue getchaintxstats(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
UniValue getchaintxstats(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
|
THROW_IF_SYNCING(KOMODO_INSYNC);
|
||||||
|
|
||||||
if (fHelp || params.size() > 2)
|
if (fHelp || params.size() > 2)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"getchaintxstats\n"
|
"getchaintxstats\n"
|
||||||
"\nCompute statistics about the total number and rate of transactions in the chain.\n"
|
"\nCompute statistics about the total number and rate of transactions in the chain.\n"
|
||||||
|
"\nThis RPC will return a large amount of additional data if the shielded index (zindex) is enabled.\n"
|
||||||
"\nArguments:\n"
|
"\nArguments:\n"
|
||||||
"1. nblocks (numeric, optional) Number of blocks in averaging window.\n"
|
"1. nblocks (numeric, optional) Number of blocks in averaging window.\n"
|
||||||
"2. blockhash (string, optional) The hash of the block which ends the window.\n"
|
"2. blockhash (string, optional) The hash of the block which ends the window.\n"
|
||||||
"\nResult:\n"
|
"\nResult:\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"time\": xxxxx, (numeric) The timestamp for the final block in the window in UNIX format.\n"
|
" \"time\": xxxxx, (numeric) The timestamp for the final block in the window in UNIX format.\n"
|
||||||
" \"txcount\": xxxxx, (numeric) The total number of transactions in the chain up to that point.\n"
|
" \"txcount\": xxxxx, (numeric) The total number of transactions in the chain up to that point.\n"
|
||||||
|
" \"shielded_txcount\": xxxxx, (numeric) The total number of shielded (containing a zaddr) transactions in the chain up to that point.\n"
|
||||||
|
" \"shielding_txcount\": xxxxx, (numeric) The total number of shielding (containing a zaddr output) transactions in the chain up to that point.\n"
|
||||||
|
" \"deshielding_txcount\": xxxxx, (numeric) The total number of deshielding (containing a zaddr input) transactions in the chain up to that point.\n"
|
||||||
|
" \"fully_shielded_txcount\": xxxxx, (numeric) The total number of z2z, AKA fully-shielded (containing only zaddr inputs+outputs) transactions in the chain up to that point.\n"
|
||||||
|
" \"payments\": xxxxx, (numeric) The total number of payments in the chain up to that point.\n"
|
||||||
|
" \"shielded_payments\": xxxxx, (numeric) The total number of shielded (containing a zaddr) payments in the chain up to that point.\n"
|
||||||
|
" \"shielding_payments\": xxxxx, (numeric) The total number of shielding (containing a zaddr output) payments in the chain up to that point.\n"
|
||||||
|
" \"deshielding_payments\": xxxxx, (numeric) The total number of deshielding (containing a zaddr input) payments in the chain up to that point.\n"
|
||||||
|
" \"fully_shielded_payments\": xxxxx, (numeric) The total number of z2z, AKA fully-shielded (containing only zaddr inputs+outputs) payments in the chain up to that point.\n"
|
||||||
|
" \"notarizations\": xxxxx, (numeric) The total number of notarization transactions in the chain up to that point.\n"
|
||||||
" \"window_final_block_hash\": \"...\", (string) The hash of the final block in the window.\n"
|
" \"window_final_block_hash\": \"...\", (string) The hash of the final block in the window.\n"
|
||||||
" \"window_block_count\": xxxxx, (numeric) Size of the window in number of blocks.\n"
|
" \"window_final_block_height\": xxxxx, (numeric) Block height of final block in window.\n"
|
||||||
" \"window_tx_count\": xxxxx, (numeric) The number of transactions in the window. Only returned if \"window_block_count\" is > 0.\n"
|
" \"window_block_count\": xxxxx, (numeric) Size of the window in number of blocks.\n"
|
||||||
" \"window_interval\": xxxxx, (numeric) The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0.\n"
|
" \"window_tx_count\": xxxxx, (numeric) The number of transactions in the window. Only returned if \"window_block_count\" is > 0.\n"
|
||||||
" \"txrate\": x.xx, (numeric) The average rate of transactions per second in the window. Only returned if \"window_interval\" is > 0.\n"
|
" \"window_interval\": xxxxx, (numeric) The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0.\n"
|
||||||
|
" \"window_shielded_txcount\": xxxxx, (numeric) The total number of shielded (containing a zaddr) transactions in the chain up to that point.\n"
|
||||||
|
" \"window_shielding_txcount\": xxxxx, (numeric) The total number of shielding (containing a zaddr output) transactions in the chain up to that point.\n"
|
||||||
|
" \"window_deshielding_txcount\": xxxxx, (numeric) The total number of deshielding (containing a zaddr input) transactions in the chain up to that point.\n"
|
||||||
|
" \"window_fully_shielded_txcount\": xxxxx, (numeric) The total number of z2z, AKA fully-shielded (containing only zaddr inputs+outputs) transactions in the chain up to that point.\n"
|
||||||
|
" \"window_shielded_payments\": xxxxx, (numeric) The total number of shielded (containing a zaddr) payments in the chain up to that point.\n"
|
||||||
|
" \"window_shielding_payments\": xxxxx, (numeric) The total number of shielding (containing a zaddr output) payments in the chain up to that point.\n"
|
||||||
|
" \"window_deshielding_payments\": xxxxx, (numeric) The total number of deshielding (containing a zaddr input) payments in the chain up to that point.\n"
|
||||||
|
" \"window_fully_shielded_payments\": xxxxx, (numeric) The total number of z2z, AKA fully-shielded (containing only zaddr inputs+outputs) payments in the chain up to that point.\n"
|
||||||
|
" \"txrate\": x.xx, (numeric) The average rate of transactions per second in the window. Only returned if \"window_interval\" is > 0.\n"
|
||||||
|
" \"shielded\": { (string) The set of stats specific to only shieled transactions. \n"
|
||||||
|
" \"fully_shielded_tx_percent\": (numeric) The percentage of fully shielded transactions.\n"
|
||||||
|
" \"shielding_tx_percent\": (numeric) The percentage of shielding transactions.\n"
|
||||||
|
" \"deshielding_tx_percent\": (numeric) The percentage of deshielding transactions.\n"
|
||||||
|
" \"fully_shielded_payments_percent\": (numeric) The percentage of fully shielded payments.\n"
|
||||||
|
" \"shielding_payments_percent\": (numeric) The percentage of shielding payments.\n"
|
||||||
|
" \"deshielding_payments_percent\": (numeric) The percentage of deshielding payments.\n"
|
||||||
|
" },\n"
|
||||||
|
" \"organic\": { (string) The set of stats about organic transactions, i.e. those that are not coinbase and not notarizations\n"
|
||||||
|
" \"fully_shielded_tx_percent\": (numeric) The percentage of fully shielded organic transactions.\n"
|
||||||
|
" \"shielding_tx_percent\": (numeric) The percentage of shielding organic transactions.\n"
|
||||||
|
" \"deshielding_tx_percent\": (numeric) The percentage of deshielding organic transactions.\n"
|
||||||
|
" \"fully_shielded_payments_percent\": (numeric) The percentage of fully shielded organic payments.\n"
|
||||||
|
" \"shielding_payments_percent\": (numeric) The percentage of shielding organic payments.\n"
|
||||||
|
" \"deshielding_payments_percent\": (numeric) The percentage of deshielding organic payments.\n"
|
||||||
|
" }\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
+ HelpExampleCli("getchaintxstats", "")
|
+ HelpExampleCli("getchaintxstats", "")
|
||||||
@@ -1929,20 +1974,120 @@ UniValue getchaintxstats(const UniValue& params, bool fHelp, const CPubKey& mypk
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CBlockIndex* pindexPast = pindex->GetAncestor(pindex->GetHeight() - blockcount);
|
const CBlockIndex* pindexPast = pindex->GetAncestor(pindex->GetHeight() - blockcount);
|
||||||
int nTimeDiff = pindex->GetMedianTimePast() - pindexPast->GetMedianTimePast();
|
int nTimeDiff = pindex->GetMedianTimePast() - pindexPast->GetMedianTimePast();
|
||||||
int nTxDiff = pindex->nChainTx - pindexPast->nChainTx;
|
int nTxDiff = pindex->nChainTx - pindexPast->nChainTx;
|
||||||
|
|
||||||
UniValue ret(UniValue::VOBJ);
|
UniValue ret(UniValue::VOBJ);
|
||||||
ret.pushKV("time", (int64_t)pindex->nTime);
|
ret.pushKV("time", (int64_t)pindex->nTime);
|
||||||
ret.pushKV("txcount", (int64_t)pindex->nChainTx);
|
ret.pushKV("txcount", (int64_t)pindex->nChainTx);
|
||||||
ret.pushKV("window_final_block_hash", pindex->GetBlockHash().GetHex());
|
ret.pushKV("window_final_block_hash", pindex->GetBlockHash().GetHex());
|
||||||
|
ret.pushKV("window_final_block_height", pindex->GetHeight());
|
||||||
ret.pushKV("window_block_count", blockcount);
|
ret.pushKV("window_block_count", blockcount);
|
||||||
|
|
||||||
|
if (fZindex) {
|
||||||
|
ret.pushKV("notarizations", (int64_t)pindex->nChainNotarizations);
|
||||||
|
ret.pushKV("shielded_txcount", (int64_t)pindex->nChainShieldedTx);
|
||||||
|
ret.pushKV("fully_shielded_txcount", (int64_t)pindex->nChainFullyShieldedTx);
|
||||||
|
ret.pushKV("deshielding_txcount", (int64_t)pindex->nChainDeshieldingTx);
|
||||||
|
ret.pushKV("shielding_txcount", (int64_t)pindex->nChainShieldingTx);
|
||||||
|
ret.pushKV("shielded_payments", (int64_t)pindex->nChainShieldedPayments);
|
||||||
|
ret.pushKV("fully_shielded_payments", (int64_t)pindex->nChainFullyShieldedPayments);
|
||||||
|
ret.pushKV("deshielding_payments", (int64_t)pindex->nChainDeshieldingPayments);
|
||||||
|
ret.pushKV("shielding_payments", (int64_t)pindex->nChainShieldingPayments);
|
||||||
|
}
|
||||||
|
|
||||||
if (blockcount > 0) {
|
if (blockcount > 0) {
|
||||||
ret.pushKV("window_tx_count", nTxDiff);
|
ret.pushKV("window_tx_count", nTxDiff);
|
||||||
ret.pushKV("window_interval", nTimeDiff);
|
ret.pushKV("window_interval", nTimeDiff);
|
||||||
|
int64_t nPaymentsDiff = pindex->nChainPayments - pindexPast->nChainPayments;
|
||||||
|
int64_t nShieldedTxDiff = pindex->nChainShieldedTx - pindexPast->nChainShieldedTx;
|
||||||
|
int64_t nShieldingTxDiff = pindex->nChainShieldingTx - pindexPast->nChainShieldingTx;
|
||||||
|
int64_t nDeshieldingTxDiff = pindex->nChainDeshieldingTx - pindexPast->nChainDeshieldingTx;
|
||||||
|
int64_t nFullyShieldedTxDiff = pindex->nChainFullyShieldedTx - pindexPast->nChainFullyShieldedTx;
|
||||||
|
int64_t nShieldedPaymentsDiff = pindex->nChainShieldedPayments - pindexPast->nChainShieldedPayments;
|
||||||
|
int64_t nShieldingPaymentsDiff = pindex->nChainShieldingPayments - pindexPast->nChainShieldingPayments;
|
||||||
|
int64_t nDeshieldingPaymentsDiff = pindex->nChainDeshieldingPayments - pindexPast->nChainDeshieldingPayments;
|
||||||
|
int64_t nFullyShieldedPaymentsDiff = pindex->nChainFullyShieldedPayments - pindexPast->nChainFullyShieldedPayments;
|
||||||
|
int64_t nNotarizationsDiff = pindex->nChainNotarizations - pindexPast->nChainNotarizations;
|
||||||
|
|
||||||
if (nTimeDiff > 0) {
|
if (nTimeDiff > 0) {
|
||||||
ret.pushKV("txrate", ((double)nTxDiff) / nTimeDiff);
|
ret.pushKV("txrate", ((double)nTxDiff) / nTimeDiff);
|
||||||
|
if (fZindex) {
|
||||||
|
ret.pushKV("notarization_txrate", ((double)nNotarizationsDiff) / nTimeDiff);
|
||||||
|
ret.pushKV("shielded_txrate", ((double)nShieldedTxDiff) / nTimeDiff);
|
||||||
|
ret.pushKV("fully_shielded_txrate", ((double)nFullyShieldedTxDiff) / nTimeDiff);
|
||||||
|
ret.pushKV("paymentrate", ((double)nPaymentsDiff) / nTimeDiff);
|
||||||
|
ret.pushKV("shielded_paymentrate", ((double)nShieldedPaymentsDiff) / nTimeDiff);
|
||||||
|
ret.pushKV("fully_shielded_paymentrate", ((double)nFullyShieldedPaymentsDiff) / nTimeDiff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fZindex) {
|
||||||
|
ret.pushKV("window_payments", (int) nPaymentsDiff);
|
||||||
|
ret.pushKV("window_notarizations", (int) nNotarizationsDiff);
|
||||||
|
ret.pushKV("window_fully_shielded_txcount", nFullyShieldedTxDiff);
|
||||||
|
ret.pushKV("window_deshielding_txcount", nDeshieldingTxDiff);
|
||||||
|
ret.pushKV("window_shielding_txcount", nShieldingTxDiff);
|
||||||
|
ret.pushKV("window_shielded_txcount", nShieldedTxDiff);
|
||||||
|
ret.pushKV("window_fully_shielded_payments", nFullyShieldedPaymentsDiff);
|
||||||
|
ret.pushKV("window_shielded_payments", nShieldedPaymentsDiff);
|
||||||
|
ret.pushKV("window_shielding_payments", nShieldingPaymentsDiff);
|
||||||
|
ret.pushKV("window_deshielding_payments", nDeshieldingPaymentsDiff);
|
||||||
|
if (nTxDiff > 0) {
|
||||||
|
ret.pushKV("shielded_tx_percent", ((double)nShieldedTxDiff) / nTxDiff);
|
||||||
|
ret.pushKV("fully_shielded_tx_percent", ((double)nFullyShieldedTxDiff) / nTxDiff);
|
||||||
|
ret.pushKV("shielding_tx_percent", ((double)nShieldingTxDiff) / nTxDiff);
|
||||||
|
ret.pushKV("deshielding_tx_percent", ((double)nDeshieldingTxDiff) / nTxDiff);
|
||||||
|
}
|
||||||
|
if (nPaymentsDiff > 0) {
|
||||||
|
ret.pushKV("shielded_payments_percent", ((double)nShieldedPaymentsDiff) / nPaymentsDiff);
|
||||||
|
ret.pushKV("fully_shielded_payments_percent", ((double)nFullyShieldedPaymentsDiff) / nPaymentsDiff);
|
||||||
|
ret.pushKV("shielding_payments_percent", ((double)nShieldingPaymentsDiff) / nPaymentsDiff);
|
||||||
|
ret.pushKV("deshielding_payments_percent", ((double)nDeshieldingPaymentsDiff) / nPaymentsDiff);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Statistics considering only zxtns
|
||||||
|
UniValue shielded(UniValue::VOBJ);
|
||||||
|
if (nShieldedTxDiff > 0) {
|
||||||
|
shielded.pushKV("fully_shielded_tx_percent", ((double)nFullyShieldedTxDiff) / nShieldedTxDiff );
|
||||||
|
shielded.pushKV("shielding_tx_percent", ((double)nShieldingTxDiff) / nShieldedTxDiff );
|
||||||
|
shielded.pushKV("deshielding_tx_percent", ((double)nDeshieldingTxDiff) / nShieldedTxDiff );
|
||||||
|
}
|
||||||
|
if (nShieldedPaymentsDiff > 0) {
|
||||||
|
shielded.pushKV("fully_shielded_payments_percent", ((double)nFullyShieldedPaymentsDiff) / nShieldedPaymentsDiff );
|
||||||
|
shielded.pushKV("shielding_payments_percent", ((double)nShieldingPaymentsDiff) / nShieldedPaymentsDiff );
|
||||||
|
shielded.pushKV("deshielding_payments_percent", ((double)nDeshieldingPaymentsDiff) / nShieldedPaymentsDiff );
|
||||||
|
}
|
||||||
|
|
||||||
|
if(nShieldedTxDiff+nShieldedPaymentsDiff > 0)
|
||||||
|
ret.pushKV("shielded", shielded);
|
||||||
|
|
||||||
|
// Organic tx stats = Raw - Coinbase - DPoW
|
||||||
|
if (nTxDiff > 0) {
|
||||||
|
UniValue organic(UniValue::VOBJ);
|
||||||
|
|
||||||
|
if(ORG(nTxDiff) > 0) {
|
||||||
|
organic.pushKV("shielded_tx_percent", ((double)nShieldedTxDiff) / ORG(nTxDiff));
|
||||||
|
organic.pushKV("fully_shielded_tx_percent", ((double)nFullyShieldedTxDiff) / ORG(nTxDiff));
|
||||||
|
organic.pushKV("shielding_tx_percent", ((double)nShieldingTxDiff) / ORG(nTxDiff));
|
||||||
|
organic.pushKV("deshielding_tx_percent", ((double)nDeshieldingTxDiff) / ORG(nTxDiff));
|
||||||
|
}
|
||||||
|
if(ORG(nPaymentsDiff) > 0) {
|
||||||
|
organic.pushKV("shielded_payments_percent", ((double)nShieldedPaymentsDiff) / ORG(nPaymentsDiff));
|
||||||
|
organic.pushKV("fully_shielded_payments_percent", ((double)nFullyShieldedPaymentsDiff) / ORG(nPaymentsDiff));
|
||||||
|
organic.pushKV("shielding_payments_percent", ((double)nShieldingPaymentsDiff) / ORG(nPaymentsDiff));
|
||||||
|
organic.pushKV("deshielding_payments_percent", ((double)nDeshieldingPaymentsDiff) / ORG(nPaymentsDiff));
|
||||||
|
}
|
||||||
|
if (nTimeDiff > 0) {
|
||||||
|
organic.pushKV("paymentrate", ((double)ORG(nPaymentsDiff)) / nTimeDiff);
|
||||||
|
organic.pushKV("txrate", ((double)ORG(nTxDiff)) / nTimeDiff);
|
||||||
|
}
|
||||||
|
organic.pushKV("txcount", (int) ORG(nTxDiff));
|
||||||
|
organic.pushKV("payments", (int) ORG(nPaymentsDiff));
|
||||||
|
ret.pushKV("organic", organic);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
|
|||||||
extern uint32_t ASSETCHAINS_CC;
|
extern uint32_t ASSETCHAINS_CC;
|
||||||
extern uint32_t ASSETCHAINS_MAGIC,ASSETCHAINS_ALGO;
|
extern uint32_t ASSETCHAINS_MAGIC,ASSETCHAINS_ALGO;
|
||||||
extern uint64_t ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY;
|
extern uint64_t ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY;
|
||||||
extern int32_t ASSETCHAINS_LWMAPOS,ASSETCHAINS_SAPLING,ASSETCHAINS_STAKED;
|
extern int32_t ASSETCHAINS_SAPLING;
|
||||||
extern uint64_t ASSETCHAINS_ENDSUBSIDY[],ASSETCHAINS_REWARD[],ASSETCHAINS_HALVING[],ASSETCHAINS_DECAY[],ASSETCHAINS_NOTARY_PAY[];
|
extern uint64_t ASSETCHAINS_ENDSUBSIDY[],ASSETCHAINS_REWARD[],ASSETCHAINS_HALVING[],ASSETCHAINS_DECAY[],ASSETCHAINS_NOTARY_PAY[];
|
||||||
extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[];
|
extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[];
|
||||||
|
|
||||||
@@ -348,10 +348,6 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|||||||
|
|
||||||
if ( ASSETCHAINS_COMMISSION != 0 )
|
if ( ASSETCHAINS_COMMISSION != 0 )
|
||||||
obj.push_back(Pair("commission", ASSETCHAINS_COMMISSION));
|
obj.push_back(Pair("commission", ASSETCHAINS_COMMISSION));
|
||||||
if ( ASSETCHAINS_STAKED != 0 )
|
|
||||||
obj.push_back(Pair("staked", ASSETCHAINS_STAKED));
|
|
||||||
if ( ASSETCHAINS_LWMAPOS != 0 )
|
|
||||||
obj.push_back(Pair("lwmapos", ASSETCHAINS_LWMAPOS));
|
|
||||||
if ( ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH )
|
if ( ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH )
|
||||||
obj.push_back(Pair("algo",ASSETCHAINS_ALGORITHMS[ASSETCHAINS_ALGO]));
|
obj.push_back(Pair("algo",ASSETCHAINS_ALGORITHMS[ASSETCHAINS_ALGO]));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ namespace TestEvalNotarisation {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static auto noop = [&](CMutableTransaction &mtx){};
|
//static auto noop = [&](CMutableTransaction &mtx){};
|
||||||
|
static auto noop = [](CMutableTransaction &mtx){};
|
||||||
|
|
||||||
|
|
||||||
template<typename Modifier>
|
template<typename Modifier>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ UniValue CallRPC(string args)
|
|||||||
BOOST_CHECK(tableRPC[strMethod]);
|
BOOST_CHECK(tableRPC[strMethod]);
|
||||||
rpcfn_type method = tableRPC[strMethod]->actor;
|
rpcfn_type method = tableRPC[strMethod]->actor;
|
||||||
try {
|
try {
|
||||||
UniValue result = (*method)(params, false);
|
UniValue result = (*method)(params, false, CPubKey());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (const UniValue& objError) {
|
catch (const UniValue& objError) {
|
||||||
|
|||||||
26
src/txdb.cpp
26
src/txdb.cpp
@@ -1,5 +1,7 @@
|
|||||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||||
|
// Copyright (c) 2019 The Hush developers
|
||||||
|
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
@@ -33,7 +35,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
// NOTE: Per issue #3277, do not use the prefix 'X' or 'x' as they were
|
// NOTE: Per zcash issue #3277, do not use the prefix 'X' or 'x' as they were
|
||||||
// previously used by DB_SAPLING_ANCHOR and DB_BEST_SAPLING_ANCHOR.
|
// previously used by DB_SAPLING_ANCHOR and DB_BEST_SAPLING_ANCHOR.
|
||||||
static const char DB_SPROUT_ANCHOR = 'A';
|
static const char DB_SPROUT_ANCHOR = 'A';
|
||||||
static const char DB_SAPLING_ANCHOR = 'Z';
|
static const char DB_SAPLING_ANCHOR = 'Z';
|
||||||
@@ -285,10 +287,12 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) const {
|
|||||||
|
|
||||||
bool CBlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo) {
|
bool CBlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo) {
|
||||||
CDBBatch batch(*this);
|
CDBBatch batch(*this);
|
||||||
|
fprintf(stderr, "%s: Writing block files\n", __FUNCTION__);
|
||||||
for (std::vector<std::pair<int, const CBlockFileInfo*> >::const_iterator it=fileInfo.begin(); it != fileInfo.end(); it++) {
|
for (std::vector<std::pair<int, const CBlockFileInfo*> >::const_iterator it=fileInfo.begin(); it != fileInfo.end(); it++) {
|
||||||
batch.Write(make_pair(DB_BLOCK_FILES, it->first), *it->second);
|
batch.Write(make_pair(DB_BLOCK_FILES, it->first), *it->second);
|
||||||
}
|
}
|
||||||
batch.Write(DB_LAST_BLOCK, nLastFile);
|
batch.Write(DB_LAST_BLOCK, nLastFile);
|
||||||
|
fprintf(stderr, "%s: Writing block index\n", __FUNCTION__);
|
||||||
for (std::vector<const CBlockIndex*>::const_iterator it=blockinfo.begin(); it != blockinfo.end(); it++) {
|
for (std::vector<const CBlockIndex*>::const_iterator it=blockinfo.begin(); it != blockinfo.end(); it++) {
|
||||||
batch.Write(make_pair(DB_BLOCK_INDEX, (*it)->GetBlockHash()), CDiskBlockIndex(*it));
|
batch.Write(make_pair(DB_BLOCK_INDEX, (*it)->GetBlockHash()), CDiskBlockIndex(*it));
|
||||||
}
|
}
|
||||||
@@ -690,18 +694,23 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
|
|||||||
boost::scoped_ptr<CDBIterator> pcursor(NewIterator());
|
boost::scoped_ptr<CDBIterator> pcursor(NewIterator());
|
||||||
|
|
||||||
pcursor->Seek(make_pair(DB_BLOCK_INDEX, uint256()));
|
pcursor->Seek(make_pair(DB_BLOCK_INDEX, uint256()));
|
||||||
|
//fprintf(stderr,"%s: Seeked cursor to block index\n",__FUNCTION__);
|
||||||
|
|
||||||
// Load mapBlockIndex
|
// Load mapBlockIndex
|
||||||
while (pcursor->Valid()) {
|
while (pcursor->Valid()) {
|
||||||
|
//fprintf(stderr,"%s: Valid cursor\n",__FUNCTION__);
|
||||||
boost::this_thread::interruption_point();
|
boost::this_thread::interruption_point();
|
||||||
std::pair<char, uint256> key;
|
std::pair<char, uint256> key;
|
||||||
if (pcursor->GetKey(key) && key.first == DB_BLOCK_INDEX) {
|
if (pcursor->GetKey(key) && key.first == DB_BLOCK_INDEX) {
|
||||||
|
//fprintf(stderr,"%s: Found DB_BLOCK_INDEX\n",__FUNCTION__);
|
||||||
CDiskBlockIndex diskindex;
|
CDiskBlockIndex diskindex;
|
||||||
if (pcursor->GetValue(diskindex)) {
|
if (pcursor->GetValue(diskindex)) {
|
||||||
// Construct block index object
|
// Construct block index object
|
||||||
CBlockIndex* pindexNew = InsertBlockIndex(diskindex.GetBlockHash());
|
//fprintf(stderr,"%s: Creating CBlockIndex...\n",__FUNCTION__);
|
||||||
|
CBlockIndex* pindexNew = InsertBlockIndex(diskindex.GetBlockHash());
|
||||||
pindexNew->pprev = InsertBlockIndex(diskindex.hashPrev);
|
pindexNew->pprev = InsertBlockIndex(diskindex.hashPrev);
|
||||||
pindexNew->SetHeight(diskindex.GetHeight());
|
pindexNew->SetHeight(diskindex.GetHeight());
|
||||||
|
//fprintf(stderr,"%s: Setting CBlockIndex height...\n",__FUNCTION__);
|
||||||
pindexNew->nFile = diskindex.nFile;
|
pindexNew->nFile = diskindex.nFile;
|
||||||
pindexNew->nDataPos = diskindex.nDataPos;
|
pindexNew->nDataPos = diskindex.nDataPos;
|
||||||
pindexNew->nUndoPos = diskindex.nUndoPos;
|
pindexNew->nUndoPos = diskindex.nUndoPos;
|
||||||
@@ -718,10 +727,21 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
|
|||||||
pindexNew->nTx = diskindex.nTx;
|
pindexNew->nTx = diskindex.nTx;
|
||||||
pindexNew->nSproutValue = diskindex.nSproutValue;
|
pindexNew->nSproutValue = diskindex.nSproutValue;
|
||||||
pindexNew->nSaplingValue = diskindex.nSaplingValue;
|
pindexNew->nSaplingValue = diskindex.nSaplingValue;
|
||||||
|
//fprintf(stderr,"%s: Setting CBlockIndex details...\n",__FUNCTION__);
|
||||||
pindexNew->segid = diskindex.segid;
|
pindexNew->segid = diskindex.segid;
|
||||||
pindexNew->nNotaryPay = diskindex.nNotaryPay;
|
pindexNew->nNotaryPay = diskindex.nNotaryPay;
|
||||||
|
pindexNew->nPayments = diskindex.nPayments;
|
||||||
|
pindexNew->nShieldedTx = diskindex.nShieldedTx;
|
||||||
|
pindexNew->nShieldedPayments = diskindex.nShieldedPayments;
|
||||||
|
pindexNew->nShieldingTx = diskindex.nShieldingTx;
|
||||||
|
pindexNew->nShieldingPayments = diskindex.nShieldingPayments;
|
||||||
|
pindexNew->nDeshieldingTx = diskindex.nDeshieldingTx;
|
||||||
|
pindexNew->nDeshieldingPayments = diskindex.nDeshieldingPayments;
|
||||||
|
pindexNew->nFullyShieldedTx = diskindex.nFullyShieldedTx;
|
||||||
|
pindexNew->nFullyShieldedPayments = diskindex.nFullyShieldedPayments;
|
||||||
|
pindexNew->nNotarizations = diskindex.nNotarizations;
|
||||||
|
|
||||||
//fprintf(stderr,"loadguts ht.%d\n",pindexNew->GetHeight());
|
//fprintf(stderr,"loadguts ht.%d\n",pindexNew->GetHeight());
|
||||||
// Consistency checks
|
// Consistency checks
|
||||||
auto header = pindexNew->GetBlockHeader();
|
auto header = pindexNew->GetBlockHeader();
|
||||||
if (header.GetHash() != pindexNew->GetBlockHash())
|
if (header.GetHash() != pindexNew->GetBlockHash())
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||||
|
// Copyright (c) 2019 The Hush developers
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user