Change datatypes, do not use VARINT, increase exception logging
This commit is contained in:
47
src/chain.h
47
src/chain.h
@@ -262,49 +262,49 @@ public:
|
|||||||
unsigned int nTx;
|
unsigned int nTx;
|
||||||
|
|
||||||
//! Number of notarization transactions in this block.
|
//! Number of notarization transactions in this block.
|
||||||
unsigned int nNotarizations;
|
int64_t nNotarizations;
|
||||||
|
|
||||||
//! (memory only) Number of payments (shielded or transparent) in the block
|
//! (memory only) Number of payments (shielded or transparent) in the block
|
||||||
//! up to and including this block. One transaction can contain one or more
|
//! up to and including this block. One transaction can contain one or more
|
||||||
//! payments. This stat allows us to calculate ratios of shielded/transparent
|
//! payments. This stat allows us to calculate ratios of shielded/transparent
|
||||||
//! when combined with shielded payment stats
|
//! when combined with shielded payment stats
|
||||||
unsigned int nPayments;
|
int64_t nPayments;
|
||||||
|
|
||||||
//! (memory only) Number of shielded transactions (of any kind) in the block up to and including this block.
|
//! (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
|
//! 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
|
//! shielding/de-shielding and other complex transaction possibilties including multiple taddrs/zaddrs as
|
||||||
//! inputs and outputs.
|
//! inputs and outputs.
|
||||||
unsigned int nShieldedTx;
|
int64_t nShieldedTx;
|
||||||
|
|
||||||
//! (memory only) Number of fully shielded transactions. A fully shielded transaction is defined
|
//! (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
|
//! 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...
|
// inputs or outputs: z->z or z->(z,z) or z->(z,z,z,) etc...
|
||||||
unsigned int nFullyShieldedTx;
|
int64_t nFullyShieldedTx;
|
||||||
|
|
||||||
//! (memory only) Number of shielding payments. A shielding payment is defined
|
//! (memory only) Number of shielding payments. A shielding payment is defined
|
||||||
//! as having a shielded output but transparent input: t->z
|
//! as having a shielded output but transparent input: t->z
|
||||||
unsigned int nShieldingPayments;
|
int64_t nShieldingPayments;
|
||||||
|
|
||||||
//! (memory only) Number of shielded payments. A shielded payment is defined
|
//! (memory only) Number of shielded payments. A shielded payment is defined
|
||||||
//! as having a shielded input or output: t->z or z->t
|
//! as having a shielded input or output: t->z or z->t
|
||||||
unsigned int nShieldedPayments;
|
int64_t nShieldedPayments;
|
||||||
|
|
||||||
//! (memory only) Number of fully shielded payments. A fully shielded payment is defined
|
//! (memory only) Number of fully shielded payments. A fully shielded payment is defined
|
||||||
//! as having a shielded input and shielded output: z->z
|
//! as having a shielded input and shielded output: z->z
|
||||||
unsigned int nFullyShieldedPayments;
|
int64_t nFullyShieldedPayments;
|
||||||
|
|
||||||
//! (memory only) Number of deshielding transactions. A deshielding transaction is defined
|
//! (memory only) Number of deshielding transactions. A deshielding transaction is defined
|
||||||
//! as a transaction containing JoinSplits and at least one transparent output.
|
//! as a transaction containing JoinSplits and at least one transparent output.
|
||||||
unsigned int nDeshieldingTx;
|
int64_t nDeshieldingTx;
|
||||||
|
|
||||||
//! (memory only) Number of deshielding payments. A deshielding payment is defined
|
//! (memory only) Number of deshielding payments. A deshielding payment is defined
|
||||||
//! as one transparent input and one shielded output: z->t
|
//! as one transparent input and one shielded output: z->t
|
||||||
unsigned int nDeshieldingPayments;
|
int64_t nDeshieldingPayments;
|
||||||
|
|
||||||
//! (memory only) Number of shielding transactions. A shielding transaction is defined
|
//! (memory only) Number of shielding transactions. A shielding transaction is defined
|
||||||
//! as a transaction containing JoinSplits and at least one transparent input
|
//! as a transaction containing JoinSplits and at least one transparent input
|
||||||
// i.e. t->z or t->(z,t) or z->(z,z,t)
|
// i.e. t->z or t->(z,t) or z->(z,z,t)
|
||||||
unsigned int nShieldingTx;
|
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.
|
||||||
@@ -414,6 +414,7 @@ public:
|
|||||||
chainPower = CChainPower();
|
chainPower = CChainPower();
|
||||||
nTx = 0;
|
nTx = 0;
|
||||||
nChainTx = 0;
|
nChainTx = 0;
|
||||||
|
|
||||||
nChainPayments = 0;
|
nChainPayments = 0;
|
||||||
nChainShieldedTx = 0;
|
nChainShieldedTx = 0;
|
||||||
nChainShieldingTx = 0;
|
nChainShieldingTx = 0;
|
||||||
@@ -424,14 +425,18 @@ public:
|
|||||||
nChainShieldingPayments = 0;
|
nChainShieldingPayments = 0;
|
||||||
nChainDeshieldingPayments = 0;
|
nChainDeshieldingPayments = 0;
|
||||||
nChainFullyShieldedPayments = 0;
|
nChainFullyShieldedPayments = 0;
|
||||||
|
|
||||||
|
nPayments = 0;
|
||||||
nShieldedTx = 0;
|
nShieldedTx = 0;
|
||||||
nShieldingTx = 0;
|
nShieldingTx = 0;
|
||||||
|
nNotarizations = 0;
|
||||||
nDeshieldingTx = 0;
|
nDeshieldingTx = 0;
|
||||||
nFullyShieldedTx = 0;
|
nFullyShieldedTx = 0;
|
||||||
nShieldedPayments = 0;
|
nShieldedPayments = 0;
|
||||||
nShieldingPayments = 0;
|
nShieldingPayments = 0;
|
||||||
nDeshieldingPayments = 0;
|
nDeshieldingPayments = 0;
|
||||||
nFullyShieldedPayments = 0;
|
nFullyShieldedPayments = 0;
|
||||||
|
|
||||||
nStatus = 0;
|
nStatus = 0;
|
||||||
nCachedBranchId = boost::none;
|
nCachedBranchId = boost::none;
|
||||||
hashSproutAnchor = uint256();
|
hashSproutAnchor = uint256();
|
||||||
@@ -649,25 +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
|
// These values only serialized when -zindex enabled
|
||||||
if((s.GetType() & SER_DISK) && fZindex) {
|
if((s.GetType() & SER_DISK) && fZindex) {
|
||||||
READWRITE(VARINT(nShieldedTx));
|
READWRITE(nShieldedTx);
|
||||||
READWRITE(VARINT(nShieldingTx));
|
READWRITE(nShieldingTx);
|
||||||
READWRITE(VARINT(nDeshieldingTx));
|
READWRITE(nDeshieldingTx);
|
||||||
READWRITE(VARINT(nFullyShieldedTx));
|
READWRITE(nFullyShieldedTx);
|
||||||
|
|
||||||
READWRITE(VARINT(nPayments));
|
READWRITE(nPayments);
|
||||||
READWRITE(VARINT(nNotarizations));
|
READWRITE(nNotarizations);
|
||||||
READWRITE(VARINT(nShieldedPayments));
|
READWRITE(nShieldedPayments);
|
||||||
READWRITE(VARINT(nShieldingPayments));
|
READWRITE(nShieldingPayments);
|
||||||
READWRITE(VARINT(nDeshieldingPayments));
|
READWRITE(nDeshieldingPayments);
|
||||||
READWRITE(VARINT(nFullyShieldedPayments));
|
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;
|
||||||
|
|||||||
@@ -287,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));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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