Skip to content

Commit

Permalink
Merge pull request #481 from peercoin/release-0.8
Browse files Browse the repository at this point in the history
Release 0.8 to develop
  • Loading branch information
backpacker69 committed Jul 28, 2019
2 parents bfd734f + b600872 commit f3b0d90
Show file tree
Hide file tree
Showing 52 changed files with 349 additions and 199 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ define(_PEERCOIN_VERSION_MAJOR, 0)
define(_PEERCOIN_VERSION_MINOR, 8)
define(_PEERCOIN_VERSION_REVISION, 0)
define(_PEERCOIN_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, false)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019)
define(_COPYRIGHT_HOLDERS,[The %s developers])
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Peercoin]])
Expand Down
15 changes: 12 additions & 3 deletions doc/build-unix.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ install necessary parts of boost:
2. If that doesn't work, you can install all boost development packages with:

sudo apt-get install libboost-all-dev

BerkeleyDB is required for the wallet.

BerkeleyDB is required for the wallet functionality.
Historically Bitcoin was first deployed with now deprecated BerkeleyDB-4.8, which has resulted in the need to upkeep the compatibility with those ancient deployments to this day. BerkeleyDB-4.8 is not compatible with more modern BerkeleyDB-5.1 and BerkeleyDB-5.3. Peercoin has inherited this in the first versions and this is why Peercoin is still officially shipped out with BerkeleyDB-4.8.
However if you running a new wallet on a new installation there is absolutely no need to run old and deprecated BerkeleyDB-4.8. Just use the one avaliable in the repository of your distribution.

**For Ubuntu only:** db4.8 packages are available [here](https://launchpad.net/~bitcoin/+archive/bitcoin).
You can add the repository and install using the following commands:
Expand Down Expand Up @@ -242,11 +244,18 @@ disable-wallet mode with:

./configure --disable-wallet

In this case there is no dependency on Berkeley DB 4.8.
In this case there is no dependency on Berkeley DB.

Mining is also possible in disable-wallet mode, but only using the `getblocktemplate` RPC
call not `getwork`.

Disable checkpoints
-------------------
It is possible to compile the node without the support for centrally issued checkpoints:

./configure --disable-checkpoints


Additional Configure Flags
--------------------------
A list of additional configure flags can be displayed with:
Expand Down
2 changes: 1 addition & 1 deletion doc/man/peercoind.1
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ Disable minting of POS blocks
.SH COPYRIGHT
Copyright \(co 2009\-2012 The Bitcoin Core developers
.br
Copyright \(co 20012\-2019 The Peercoin developers
Copyright \(co 2012\-2019 The Peercoin developers
.PP
Please contribute if you find Peercoin useful. Visit
<https://peercoin.net/> for further information about the software.
Expand Down
3 changes: 2 additions & 1 deletion scripts/dependencies-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ sudo apt-get install -y -qq miniupnpc libminiupnpc-dev gettext libevent-dev prot
#for gui
sudo apt-get install -y -qq qtbase5-dev qttools5-dev-tools
sudo apt-get install -y -qq libdb++-dev

#for debuild
sudo apt-get install -y -qq libfakeroot fakeroot
4 changes: 1 addition & 3 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,14 @@ RES_ICONS = \
qt/res/icons/tx_mined.png \
qt/res/icons/warning.png \
qt/res/icons/verify.png \
qt/res/images/logo.png \
qt/res/images/logomask.png \
qt/res/images/splash.png \
qt/res/images/about.png \
qt/res/images/controls/caret-down.png \
qt/res/images/controls/caret-up.png \
qt/res/images/controls/scroll-down.png \
qt/res/images/controls/scroll-up.png \
qt/res/images/logo.png \
qt/res/images/logomask.png \
qt/res/images/mantis.png \
qt/res/images/splash.png \
qt/res/images/splash_testnet.png \
qt/res/images/transparent-background.png \
Expand Down
9 changes: 9 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class CMainParams : public CChainParams {
vSeeds.emplace_back("seed2.peercoin.net");
vSeeds.emplace_back("seed.peercoin-library.org");
vSeeds.emplace_back("ppcseed.ns.7server.net");
vSeeds.emplace_back("seed.ppcoin.info");

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,55); // peercoin: addresses begin with 'P'
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,117); // peercoin: addresses begin with 'p'
Expand Down Expand Up @@ -150,6 +151,7 @@ class CMainParams : public CChainParams {
{336000, uint256S("0x4d261cef6e61a5ed8325e560f1d6e36f4698853a4c7134677f47a1d1d842bdf6")},
{371850, uint256S("0x6b18adcb0a6e080dae85b74eee2b83fabb157bbea64fab0ed2192b2f6d5b89f3")},
{407813, uint256S("0x00000000000000012730b0f48bed8afbeb08164c9d63597afb082e82ea05cec9")},
{443561, uint256S("0xf81cea8e4e40b2cfcc13a8bd82436399c35a55df951b95e7128601c1838029ed")},
}
};

Expand Down Expand Up @@ -216,6 +218,7 @@ class CTestNetParams : public CChainParams {
vSeeds.emplace_back("tseed.peercoin.net");
vSeeds.emplace_back("tseed2.peercoin.net");
vSeeds.emplace_back("tseed.peercoin-library.org");
vSeeds.emplace_back("testseed.ppcoin.info");

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
Expand Down Expand Up @@ -244,6 +247,7 @@ class CTestNetParams : public CChainParams {
{336000, uint256S("0xf07adf61615c529f7c282b858d13d3e037b197324cb12e0669c461947494c4e3")},
{372751, uint256S("0x000000000000148db599b217c117b5104f5043c55f6ca2a8a065d9fab9f9bba1")},
{382019, uint256S("0x3ab75769d7957d9bf0857b5019d0a0e41044fa9ecf30b2f9c32aa457b0864ce5")},
{412691, uint256S("0x0e20318be88f07f521453435b37cfc516c3de07264a78ed7170985a1126126ab")},
}
};

Expand Down Expand Up @@ -276,6 +280,11 @@ class CRegTestParams : public CChainParams {
consensus.nTargetSpacingWorkMax = 12 * consensus.nStakeTargetSpacing; // 2-hour
consensus.nPowTargetSpacing = consensus.nStakeTargetSpacing;

consensus.nStakeMinAge = 60 * 60 * 24; // test net min age is 1 day
consensus.nStakeMaxAge = 60 * 60 * 24 * 90;
consensus.nModifierInterval = 60 * 20; // Modifier interval: time to elapse before new modifier is computed
consensus.nCoinbaseMaturity = 60;

consensus.fPowAllowMinDifficultyBlocks = true;
consensus.fPowNoRetargeting = true;
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
Expand Down
2 changes: 1 addition & 1 deletion src/consensus/tx_verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CValidationState;
bool CheckTransaction(const CTransaction& tx, CValidationState& state, bool fCheckDuplicateInputs=true);

namespace Consensus {
class Params;
struct Params;
/**
* Check whether all inputs of this transaction are valid (no double spends and amounts)
* This does not modify the UTXO set. This does not check scripts and sigs.
Expand Down
1 change: 1 addition & 0 deletions src/core_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry,
entry.pushKV("txid", tx.GetHash().GetHex());
entry.pushKV("hash", tx.GetWitnessHash().GetHex());
entry.pushKV("version", tx.nVersion);
entry.pushKV("time", (int64_t)tx.nTime);
entry.pushKV("size", (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION));
entry.pushKV("vsize", (GetTransactionWeight(tx) + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR);
entry.pushKV("locktime", (int64_t)tx.nLockTime);
Expand Down
5 changes: 3 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ std::string LicenseInfo()
const std::string URL_SOURCE_CODE = "<https://github.com/peercoin/peercoin>";
const std::string URL_WEBSITE = "<https://peercoin.net/>";

return CopyrightHolders(strprintf(_("Copyright (C) %i-%i"), 2009, COPYRIGHT_YEAR) + " ") + "\n" +
return CopyrightHolders(strprintf(_("Copyright (C) %i-%i"), 2012, COPYRIGHT_YEAR) + " ") + "\n" +
"\n" +
strprintf(_("Please contribute if you find %s useful. "
"Visit %s for further information about the software."),
Expand Down Expand Up @@ -1003,6 +1003,7 @@ bool AppInitParameterInteraction()
nScriptCheckThreads = MAX_SCRIPTCHECK_THREADS;

// block pruning; get the amount of disk space (in MiB) to allot for block & undo files
/*
int64_t nPruneArg = gArgs.GetArg("-prune", 0);
if (nPruneArg < 0) {
return InitError(_("Prune cannot be configured with a negative value."));
Expand All @@ -1019,7 +1020,7 @@ bool AppInitParameterInteraction()
LogPrintf("Prune configured to target %uMiB on disk for block and undo files.\n", nPruneTarget / 1024 / 1024);
fPruneMode = true;
}

*/
nConnectTimeout = gArgs.GetArg("-timeout", DEFAULT_CONNECT_TIMEOUT);
if (nConnectTimeout <= 0)
nConnectTimeout = DEFAULT_CONNECT_TIMEOUT;
Expand Down
20 changes: 11 additions & 9 deletions src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const unsigned int nProtocolV07SwitchTime = 1552392000; // Tue 12 Mar 12:00:
const unsigned int nProtocolV07TestSwitchTime = 1541505600; // Tue 06 Nov 12:00:00 UTC 2018

// Switch time for new BIPs from bitcoin 0.16.x
const uint32_t nBTC16BIPsSwitchTime = 32548219200; // Fri 31 May 12:00:00 UTC 3001
const uint32_t nBTC16BIPsSwitchTime = 1569931200; // Tue 01 Oct 12:00:00 UTC 2019
const uint32_t nBTC16BIPsTestSwitchTime = 1554811200; // Tue 09 Apr 12:00:00 UTC 2019

// Hard checkpoints of stake modifiers to ensure they are deterministic
Expand All @@ -50,6 +50,7 @@ static std::map<int, unsigned int> mapStakeModifierCheckpoints =
(336000, 0x6c3c8048u )
(371850, 0x9b850bdfu )
(407813, 0x46fe50b5u )
(443561, 0x114a6e38u )
;

static std::map<int, unsigned int> mapStakeModifierTestnetCheckpoints =
Expand All @@ -62,39 +63,40 @@ static std::map<int, unsigned int> mapStakeModifierTestnetCheckpoints =
(336000, 0x8330dc09u )
(372751, 0xafb94e2fu )
(382019, 0x7f5cf5ebu )
(412691, 0x93138e67u )
;

// Whether the given coinstake is subject to new v0.3 protocol
bool IsProtocolV03(unsigned int nTimeCoinStake)
{
return (nTimeCoinStake >= (Params().NetworkIDString() == CBaseChainParams::TESTNET ? nProtocolV03TestSwitchTime : nProtocolV03SwitchTime));
return (nTimeCoinStake >= (Params().NetworkIDString() != CBaseChainParams::MAIN ? nProtocolV03TestSwitchTime : nProtocolV03SwitchTime));
}

// Whether the given block is subject to new v0.4 protocol
bool IsProtocolV04(unsigned int nTimeBlock)
{
return (nTimeBlock >= (Params().NetworkIDString() == CBaseChainParams::TESTNET ? nProtocolV04TestSwitchTime : nProtocolV04SwitchTime));
return (nTimeBlock >= (Params().NetworkIDString() != CBaseChainParams::MAIN ? nProtocolV04TestSwitchTime : nProtocolV04SwitchTime));
}

// Whether the given transaction is subject to new v0.5 protocol
bool IsProtocolV05(unsigned int nTimeTx)
{
return (nTimeTx >= (Params().NetworkIDString() == CBaseChainParams::TESTNET ? nProtocolV05TestSwitchTime : nProtocolV05SwitchTime));
return (nTimeTx >= (Params().NetworkIDString() != CBaseChainParams::MAIN ? nProtocolV05TestSwitchTime : nProtocolV05SwitchTime));
}

// Whether a given block is subject to new v0.6 protocol
// Test against previous block index! (always available)
bool IsProtocolV06(const CBlockIndex* pindexPrev)
{
if (pindexPrev->nTime < (Params().NetworkIDString() == CBaseChainParams::TESTNET ? nProtocolV06TestSwitchTime : nProtocolV06SwitchTime))
if (pindexPrev->nTime < (Params().NetworkIDString() != CBaseChainParams::MAIN ? nProtocolV06TestSwitchTime : nProtocolV06SwitchTime))
return false;

// if 900 of the last 1,000 blocks are version 2 or greater (90/100 if testnet):
// Soft-forking PoS can be dangerous if the super majority is too low
// The stake majority will decrease after the fork
// since only coindays of updated nodes will get destroyed.
if ((Params().NetworkIDString() != CBaseChainParams::TESTNET && IsSuperMajority(2, pindexPrev, 900, 1000)) ||
(Params().NetworkIDString() == CBaseChainParams::TESTNET && IsSuperMajority(2, pindexPrev, 90, 100)))
if ((Params().NetworkIDString() == CBaseChainParams::MAIN && IsSuperMajority(2, pindexPrev, 900, 1000)) ||
(Params().NetworkIDString() != CBaseChainParams::MAIN && IsSuperMajority(2, pindexPrev, 90, 100)))
return true;

return false;
Expand All @@ -103,13 +105,13 @@ bool IsProtocolV06(const CBlockIndex* pindexPrev)
// Whether a given transaction is subject to new v0.7 protocol
bool IsProtocolV07(unsigned int nTimeTx)
{
bool fTestNet = Params().NetworkIDString() == CBaseChainParams::TESTNET;
bool fTestNet = Params().NetworkIDString() != CBaseChainParams::MAIN;
return (nTimeTx >= (fTestNet? nProtocolV07TestSwitchTime : nProtocolV07SwitchTime));
}

bool IsBTC16BIPsEnabled(uint32_t nTimeTx)
{
bool fTestNet = Params().NetworkIDString() == CBaseChainParams::TESTNET;
bool fTestNet = Params().NetworkIDString() != CBaseChainParams::MAIN;
return (nTimeTx >= (fTestNet? nBTC16BIPsTestSwitchTime : nBTC16BIPsSwitchTime));
}

Expand Down
4 changes: 3 additions & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ std::string strSubVersion;

limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ);

// peercoin: temperature to measure how many PoS headers have been sent by this client
std::map<CNetAddr, int32_t> mapPoSTemperature;

void CConnman::AddOneShot(const std::string& strDest)
{
LOCK(cs_vOneShots);
Expand Down Expand Up @@ -2743,7 +2746,6 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
fPauseRecv = false;
fPauseSend = false;
nProcessQueueSize = 0;
nPoSTemperature = MAX_CONSECUTIVE_POS_HEADERS/4;
lastAcceptedHeader = uint256();

for (const std::string &msg : getAllNetMessageTypes())
Expand Down
8 changes: 4 additions & 4 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ static const size_t DEFAULT_MAXSENDBUFFER = 1 * 1000;
static const unsigned int DEFAULT_MISBEHAVING_BANTIME = 60 * 60 * 24; // Default 24-hour ban

/** peercoin: Number of consecutive PoS headers are allowed from a single peer. Used to prevent out of memory attack. */
static const unsigned int MAX_CONSECUTIVE_POS_HEADERS = 1000;
// const unsigned int POW_HEADER_COOLING - defined in protocol.cpp, so that it is visible to other files
static const int32_t MAX_CONSECUTIVE_POS_HEADERS = 1000;

// const unsigned int POW_HEADER_COOLING = 70; - defined in protocol.cpp, so that it is visible to other files

typedef int64_t NodeId;

Expand Down Expand Up @@ -519,6 +520,7 @@ struct LocalServiceInfo {

extern CCriticalSection cs_mapLocalHost;
extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost;
extern std::map<CNetAddr, int32_t> mapPoSTemperature;
typedef std::map<std::string, uint64_t> mapMsgCmdSize; //command, total bytes

class CNodeStats
Expand Down Expand Up @@ -723,8 +725,6 @@ class CNode
CCriticalSection cs_feeFilter;
CAmount lastSentFeeFilter;
int64_t nextSendTimeFeeFilter;
// peercoin: temperature to measure how many PoS headers have been sent by this client
uint32_t nPoSTemperature;
// peercoin: used to detect branch switches
uint256 lastAcceptedHeader;

Expand Down
Loading

0 comments on commit f3b0d90

Please sign in to comment.