Major updates integration from all upstreams

This commit is contained in:
miketout
2018-09-18 14:33:53 -07:00
396 changed files with 25517 additions and 6854 deletions

View File

@@ -102,6 +102,7 @@ static const unsigned int DATABASE_WRITE_INTERVAL = 60 * 60;
static const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60;
/** Maximum length of reject messages. */
static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111;
static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60;
//static const bool DEFAULT_ADDRESSINDEX = false;
//static const bool DEFAULT_SPENTINDEX = false;
@@ -149,6 +150,7 @@ extern bool fCoinbaseEnforcedProtectionEnabled;
extern size_t nCoinCacheUsage;
extern CFeeRate minRelayTxFee;
extern bool fAlerts;
extern int64_t nMaxTipAge;
/** Best header we've seen so far (used for getheaders queries' starting points). */
extern CBlockIndex *pindexBestHeader;
@@ -287,11 +289,11 @@ struct CTimestampIndexIteratorKey {
return 4;
}
template<typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const {
void Serialize(Stream& s) const {
ser_writedata32be(s, timestamp);
}
template<typename Stream>
void Unserialize(Stream& s, int nType, int nVersion) {
void Unserialize(Stream& s) {
timestamp = ser_readdata32be(s);
}
@@ -316,14 +318,14 @@ struct CTimestampIndexKey {
return 36;
}
template<typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const {
void Serialize(Stream& s) const {
ser_writedata32be(s, timestamp);
blockHash.Serialize(s, nType, nVersion);
blockHash.Serialize(s);
}
template<typename Stream>
void Unserialize(Stream& s, int nType, int nVersion) {
void Unserialize(Stream& s) {
timestamp = ser_readdata32be(s);
blockHash.Unserialize(s, nType, nVersion);
blockHash.Unserialize(s);
}
CTimestampIndexKey(unsigned int time, uint256 hash) {
@@ -349,13 +351,13 @@ struct CTimestampBlockIndexKey {
}
template<typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const {
blockHash.Serialize(s, nType, nVersion);
void Serialize(Stream& s) const {
blockHash.Serialize(s);
}
template<typename Stream>
void Unserialize(Stream& s, int nType, int nVersion) {
blockHash.Unserialize(s, nType, nVersion);
void Unserialize(Stream& s) {
blockHash.Unserialize(s);
}
CTimestampBlockIndexKey(uint256 hash) {
@@ -378,12 +380,12 @@ struct CTimestampBlockIndexValue {
}
template<typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const {
void Serialize(Stream& s) const {
ser_writedata32be(s, ltimestamp);
}
template<typename Stream>
void Unserialize(Stream& s, int nType, int nVersion) {
void Unserialize(Stream& s) {
ltimestamp = ser_readdata32be(s);
}
@@ -410,17 +412,17 @@ struct CAddressUnspentKey {
return 57;
}
template<typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const {
void Serialize(Stream& s) const {
ser_writedata8(s, type);
hashBytes.Serialize(s, nType, nVersion);
txhash.Serialize(s, nType, nVersion);
hashBytes.Serialize(s);
txhash.Serialize(s);
ser_writedata32(s, index);
}
template<typename Stream>
void Unserialize(Stream& s, int nType, int nVersion) {
void Unserialize(Stream& s) {
type = ser_readdata8(s);
hashBytes.Unserialize(s, nType, nVersion);
txhash.Unserialize(s, nType, nVersion);
hashBytes.Unserialize(s);
txhash.Unserialize(s);
index = ser_readdata32(s);
}
@@ -443,7 +445,7 @@ struct CAddressUnspentKey {
}
};
struct CAddressUnspentValue {
struct CAddressUnspentValue {
CAmount satoshis;
CScript script;
int blockHeight;
@@ -451,9 +453,9 @@ struct CAddressUnspentValue {
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(satoshis);
READWRITE(script);
READWRITE(*(CScriptBase*)(&script));
READWRITE(blockHeight);
}
@@ -491,24 +493,24 @@ struct CAddressIndexKey {
return 66;
}
template<typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const {
void Serialize(Stream& s) const {
ser_writedata8(s, type);
hashBytes.Serialize(s, nType, nVersion);
hashBytes.Serialize(s);
// Heights are stored big-endian for key sorting in LevelDB
ser_writedata32be(s, blockHeight);
ser_writedata32be(s, txindex);
txhash.Serialize(s, nType, nVersion);
txhash.Serialize(s);
ser_writedata32(s, index);
char f = spending;
ser_writedata8(s, f);
}
template<typename Stream>
void Unserialize(Stream& s, int nType, int nVersion) {
void Unserialize(Stream& s) {
type = ser_readdata8(s);
hashBytes.Unserialize(s, nType, nVersion);
hashBytes.Unserialize(s);
blockHeight = ser_readdata32be(s);
txindex = ser_readdata32be(s);
txhash.Unserialize(s, nType, nVersion);
txhash.Unserialize(s);
index = ser_readdata32(s);
char f = ser_readdata8(s);
spending = f;
@@ -549,14 +551,14 @@ struct CAddressIndexIteratorKey {
return 21;
}
template<typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const {
void Serialize(Stream& s) const {
ser_writedata8(s, type);
hashBytes.Serialize(s, nType, nVersion);
hashBytes.Serialize(s);
}
template<typename Stream>
void Unserialize(Stream& s, int nType, int nVersion) {
void Unserialize(Stream& s) {
type = ser_readdata8(s);
hashBytes.Unserialize(s, nType, nVersion);
hashBytes.Unserialize(s);
}
CAddressIndexIteratorKey(unsigned int addressType, uint160 addressHash) {
@@ -583,15 +585,15 @@ struct CAddressIndexIteratorHeightKey {
return 25;
}
template<typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const {
void Serialize(Stream& s) const {
ser_writedata8(s, type);
hashBytes.Serialize(s, nType, nVersion);
hashBytes.Serialize(s);
ser_writedata32be(s, blockHeight);
}
template<typename Stream>
void Unserialize(Stream& s, int nType, int nVersion) {
void Unserialize(Stream& s) {
type = ser_readdata8(s);
hashBytes.Unserialize(s, nType, nVersion);
hashBytes.Unserialize(s);
blockHeight = ser_readdata32be(s);
}
@@ -619,7 +621,7 @@ struct CDiskTxPos : public CDiskBlockPos
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(*(CDiskBlockPos*)this);
READWRITE(VARINT(nTxOffset));
}
@@ -829,8 +831,11 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat
* When there are blocks in the active chain with missing data (e.g. if the
* activation height and branch ID of a particular upgrade have been altered),
* rewind the chainstate and remove them from the block index.
*
* clearWitnessCaches is an output parameter that will be set to true iff
* witness caches should be cleared in order to handle an intended long rewind.
*/
bool RewindBlockIndex(const CChainParams& params);
bool RewindBlockIndex(const CChainParams& params, bool& clearWitnessCaches);
class CBlockFileInfo
{
@@ -846,7 +851,7 @@ public:
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(VARINT(nBlocks));
READWRITE(VARINT(nSize));
READWRITE(VARINT(nUndoSize));