( 6000, uint256("0x000000000945e3c9d8e15df834e802521eb79f9ceb4191a27bdfadad4b777f4a"))
( 8700, uint256("0x00000000014270724837789c9a69859290f6bdee38556bc4561c21f17935a178"))
( 13560, uint256("0xa1591a0fcbf11f282d671581edb9f0aadcd06fee69761081e0a3245914c13729"))
+ ( 14189, uint256("0x00000000020f76474d2522b19c7bfafc43ba6ecbabae54293bcd9546159c8c1d"))
;
bool CheckHardened(int nHeight, const uint256& hash)
set<pair<COutPoint, unsigned int> > setStakeSeen;
uint256 hashGenesisBlock = hashGenesisBlockOfficial;
static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20);
-static CBigNum bnProofOfStakeLimit(~uint256(0) >> 30);
+static CBigNum bnProofOfStakeLimit(~uint256(0) >> 24);
+static CBigNum bnProofOfStakeHardLimit(~uint256(0) >> 30);
static CBigNum bnInitialHashTarget(~uint256(0) >> 20);
unsigned int nStakeMinAge = STAKE_MIN_AGE;
int nCoinbaseMaturity = COINBASE_MATURITY_PPC;
// minimum amount of work that could possibly be required nTime after
// minimum work required was nBase
//
-unsigned int ComputeMinWork(unsigned int nBase, int64 nTime)
+unsigned int ComputeMinWork(unsigned int nBase, int64 nTime, bool fProofOfStake, int nHeight)
{
+ CBigNum bnTargetLimit = bnProofOfWorkLimit;
+
+ if(fProofOfStake)
+ {
+ // Proof-of-Stake blocks has own target limit since nVersion=3 supermajority on mainNet and always on testNet
+ if(fTestNet || nHeight > 15000)
+ bnTargetLimit = bnProofOfStakeLimit;
+ else if(nHeight > 14060)
+ bnTargetLimit = bnProofOfStakeHardLimit;
+ }
+
CBigNum bnResult;
bnResult.SetCompact(nBase);
bnResult *= 2;
- while (nTime > 0 && bnResult < bnProofOfWorkLimit)
+ while (nTime > 0 && bnResult < bnTargetLimit)
{
// Maximum 200% adjustment per day...
bnResult *= 2;
nTime -= 24 * 60 * 60;
}
- if (bnResult > bnProofOfWorkLimit)
- bnResult = bnProofOfWorkLimit;
+ if (bnResult > bnTargetLimit)
+ bnResult = bnTargetLimit;
return bnResult.GetCompact();
}
unsigned int static GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake)
{
- CBigNum bnTargetLimit = (fProofOfStake && CBlockIndex::IsSuperMajority(3, pindexLast, 950, 1000)) ? bnProofOfStakeLimit : bnProofOfWorkLimit;
+ CBigNum bnTargetLimit = bnProofOfWorkLimit;
+
+ if(fProofOfStake)
+ {
+ // Proof-of-Stake blocks has own target limit since nVersion=3 supermajority on mainNet and always on testNet
+ if(fTestNet || (pindexLast->nHeight + 1 > 15000))
+ bnTargetLimit = bnProofOfStakeLimit;
+ else if(pindexLast->nHeight + 1 > 14060)
+ bnTargetLimit = bnProofOfStakeHardLimit;
+ }
if (pindexLast == NULL)
return bnTargetLimit.GetCompact(); // genesis block
return true;
}
+int CBlock::GetBlockHeight() const
+{
+ if(nVersion == 1)
+ return 0;
+
+ if(vtx[0].vin[0].scriptSig[0] > 4)
+ return vtx[0].vin[0].scriptSig[0] - 80;
+
+ int nBlockHeight = 0;
+
+ memcpy((void *)&nBlockHeight, (const void *)&vtx[0].vin[0].scriptSig[1], vtx[0].vin[0].scriptSig[0]);
+
+#ifdef BIGENDIAN
+ return htonl(nBlockHeight);
+#else
+ return nBlockHeight;
+#endif
+}
+
bool CBlock::AcceptBlock()
{
// Check for duplicate
if (!Checkpoints::CheckSync(hash, pindexPrev))
return error("AcceptBlock() : rejected by synchronized checkpoint");
- // Reject block.nVersion < 3 blocks when 95% (75% on testnet) of the network has upgraded:
- if (nVersion < 3)
- {
- if ((!fTestNet && CBlockIndex::IsSuperMajority(3, pindexPrev, 950, 1000)) || (fTestNet && CBlockIndex::IsSuperMajority(3, pindexPrev, 75, 100)))
- {
- return error("CheckBlock() : rejected nVersion < 3 block");
- }
- }
+ // Reject block.nVersion < 3 blocks since 95% threshold on mainNet and always on testNet:
+ if (nVersion < 3 && ((!fTestNet && nHeight > 14060) || (fTestNet && nHeight > 0)))
+ return error("CheckBlock() : rejected nVersion < 3 block");
- if(nHeight > 0)
- {
- CScript expect = CScript() << nHeight;
+ CScript expect = CScript() << nHeight;
+ if (!std::equal(expect.begin(), expect.end(), vtx[0].vin[0].scriptSig.begin()))
+ return DoS(100, error("AcceptBlock() : block height mismatch in coinbase"));
+
+ /**
+ * TODO: replace previous check with this.
+ */
+
+ // if(nHeight != GetBlockHeight())
+ // return DoS(100, error("AcceptBlock() : block height mismatch in coinbase"));
- if (!std::equal(expect.begin(), expect.end(), vtx[0].vin[0].scriptSig.begin()))
- return DoS(100, error("AcceptBlock() : block height mismatch in coinbase"));
- }
// Write block to history file
if (!CheckDiskSpace(::GetSerializeSize(*this, SER_DISK, CLIENT_VERSION)))
CBigNum bnNewBlock;
bnNewBlock.SetCompact(pblock->nBits);
CBigNum bnRequired;
- bnRequired.SetCompact(ComputeMinWork(GetLastBlockIndex(pcheckpoint, pblock->IsProofOfStake())->nBits, deltaTime));
+ bnRequired.SetCompact(ComputeMinWork(GetLastBlockIndex(pcheckpoint, pblock->IsProofOfStake())->nBits, deltaTime, pblock->IsProofOfStake(), pblock->GetBlockHeight()));
if (bnNewBlock > bnRequired)
{
{
vector<valtype> vSolutions;
txnouttype whichType;
- int nVouts = nTime < 1361664000 ? 1 : vtx[0].vout.size();
if(!IsProofOfStake())
{
- for(int i = 0; i < nVouts; i++)
+ for(int i = 0; i < vtx[0].vout.size(); i++)
{
const CTxOut& txout = vtx[0].vout[i];
vector<valtype> vSolutions;
txnouttype whichType;
- int nVouts = nTime < 1361664000 ? 1 : vtx[0].vout.size();
if(IsProofOfStake())
{
}
else
{
- for(int i = 0; i < nVouts; i++)
+ for(int i = 0; i < vtx[0].vout.size(); i++)
{
const CTxOut& txout = vtx[0].vout[i];
return false;
}
-
-
-
-
-
bool CheckDiskSpace(uint64 nAdditionalBytes)
{
uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available;
bool CheckProofOfWork(uint256 hash, unsigned int nBits);
int64 GetProofOfWorkReward(unsigned int nBits);
int64 GetProofOfStakeReward(int64 nCoinAge);
-unsigned int ComputeMinWork(unsigned int nBase, int64 nTime);
+unsigned int ComputeMinWork(unsigned int nBase, int64 nTime, bool fProofOfStake, int nHeight);
int GetNumBlocksOfPeers();
bool IsInitialBlockDownload();
std::string GetWarnings(std::string strFor);
return thash;
}
+ int GetBlockHeight() const;
int64 GetBlockTime() const
{
return (nFlags & BLOCK_PROOF_OF_STAKE);
}
- static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned int nRequired, unsigned int nToCheck)
- {
- unsigned int nFound = 0;
- for (unsigned int i = 0; i < nToCheck && nFound < nRequired && pstart != NULL; i++)
- {
- if (pstart->nVersion >= minVersion)
- ++nFound;
- pstart = pstart->pprev;
- }
- return (nFound >= nRequired);
- }
-
void SetProofOfStake()
{
nFlags |= BLOCK_PROOF_OF_STAKE;
public:
uint256 hashPrev;
uint256 hashNext;
- int nProtocolVersion;
CDiskBlockIndex()
{
hashPrev = 0;
hashNext = 0;
- nProtocolVersion = PROTOCOL_VERSION;
}
explicit CDiskBlockIndex(CBlockIndex* pindex) : CBlockIndex(*pindex)
READWRITE(nMoneySupply);
READWRITE(nFlags);
READWRITE(nStakeModifier);
- READWRITE(nProtocolVersion);
if (IsProofOfStake())
{
READWRITE(prevoutStake);
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>OverviewPage</class>
- <widget class="QWidget" name="OverviewPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>552</width>
- <height>342</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QFrame" name="frame">
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QFormLayout" name="formLayout_2">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
- </property>
- <property name="horizontalSpacing">
- <number>12</number>
- </property>
- <property name="verticalSpacing">
- <number>12</number>
- </property>
- <item row="2" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Balance:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="labelBalance">
- <property name="text">
- <string notr="true">0 BTC</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Number of transactions:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QLabel" name="labelNumTransactions">
- <property name="text">
- <string>0</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Unconfirmed:</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QLabel" name="labelUnconfirmed">
- <property name="text">
- <string notr="true">0 BTC</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Stake:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLabel" name="labelStake">
- <property name="text">
- <string notr="true">0 BTC</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_5">
- <property name="font">
- <font>
- <pointsize>11</pointsize>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Wallet</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QFrame" name="frame_2">
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string><b>Recent transactions</b></string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QListView" name="listTransactions">
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ui version="4.0">\r
+ <class>OverviewPage</class>\r
+ <widget class="QWidget" name="OverviewPage">\r
+ <property name="geometry">\r
+ <rect>\r
+ <x>0</x>\r
+ <y>0</y>\r
+ <width>552</width>\r
+ <height>342</height>\r
+ </rect>\r
+ </property>\r
+ <property name="windowTitle">\r
+ <string>Form</string>\r
+ </property>\r
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">\r
+ <item>\r
+ <layout class="QVBoxLayout" name="verticalLayout_2">\r
+ <item>\r
+ <widget class="QFrame" name="frame">\r
+ <property name="frameShape">\r
+ <enum>QFrame::StyledPanel</enum>\r
+ </property>\r
+ <property name="frameShadow">\r
+ <enum>QFrame::Raised</enum>\r
+ </property>\r
+ <layout class="QFormLayout" name="formLayout_2">\r
+ <property name="fieldGrowthPolicy">\r
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>\r
+ </property>\r
+ <property name="horizontalSpacing">\r
+ <number>12</number>\r
+ </property>\r
+ <property name="verticalSpacing">\r
+ <number>12</number>\r
+ </property>\r
+ <item row="2" column="0">\r
+ <widget class="QLabel" name="label">\r
+ <property name="text">\r
+ <string>Balance:</string>\r
+ </property>\r
+ </widget>\r
+ </item>\r
+ <item row="2" column="1">\r
+ <widget class="QLabel" name="labelBalance">\r
+ <property name="text">\r
+ <string notr="true">0 NVC</string>\r
+ </property>\r
+ </widget>\r
+ </item>\r
+ <item row="5" column="0">\r
+ <widget class="QLabel" name="label_2">\r
+ <property name="text">\r
+ <string>Number of transactions:</string>\r
+ </property>\r
+ </widget>\r
+ </item>\r
+ <item row="5" column="1">\r
+ <widget class="QLabel" name="labelNumTransactions">\r
+ <property name="text">\r
+ <string>0</string>\r
+ </property>\r
+ </widget>\r
+ </item>\r
+ <item row="4" column="0">\r
+ <widget class="QLabel" name="label_3">\r
+ <property name="text">\r
+ <string>Unconfirmed:</string>\r
+ </property>\r
+ </widget>\r
+ </item>\r
+ <item row="4" column="1">\r
+ <widget class="QLabel" name="labelUnconfirmed">\r
+ <property name="text">\r
+ <string notr="true">0 NVC</string>\r
+ </property>\r
+ </widget>\r
+ </item>\r
+ <item row="3" column="0">\r
+ <widget class="QLabel" name="label_6">\r
+ <property name="text">\r
+ <string>Stake:</string>\r
+ </property>\r
+ </widget>\r
+ </item>\r
+ <item row="3" column="1">\r
+ <widget class="QLabel" name="labelStake">\r
+ <property name="text">\r
+ <string notr="true">0 NVC</string>\r
+ </property>\r
+ </widget>\r
+ </item>\r
+ <item row="1" column="0">\r
+ <widget class="QLabel" name="label_5">\r
+ <property name="font">\r
+ <font>\r
+ <pointsize>11</pointsize>\r
+ <weight>75</weight>\r
+ <bold>true</bold>\r
+ </font>\r
+ </property>\r
+ <property name="text">\r
+ <string>Wallet</string>\r
+ </property>\r
+ </widget>\r
+ </item>\r
+ </layout>\r
+ </widget>\r
+ </item>\r
+ <item>\r
+ <spacer name="verticalSpacer">\r
+ <property name="orientation">\r
+ <enum>Qt::Vertical</enum>\r
+ </property>\r
+ <property name="sizeHint" stdset="0">\r
+ <size>\r
+ <width>20</width>\r
+ <height>40</height>\r
+ </size>\r
+ </property>\r
+ </spacer>\r
+ </item>\r
+ </layout>\r
+ </item>\r
+ <item>\r
+ <layout class="QVBoxLayout" name="verticalLayout_3">\r
+ <item>\r
+ <widget class="QFrame" name="frame_2">\r
+ <property name="frameShape">\r
+ <enum>QFrame::StyledPanel</enum>\r
+ </property>\r
+ <property name="frameShadow">\r
+ <enum>QFrame::Raised</enum>\r
+ </property>\r
+ <layout class="QVBoxLayout" name="verticalLayout">\r
+ <item>\r
+ <widget class="QLabel" name="label_4">\r
+ <property name="text">\r
+ <string><b>Recent transactions</b></string>\r
+ </property>\r
+ </widget>\r
+ </item>\r
+ <item>\r
+ <widget class="QListView" name="listTransactions">\r
+ <property name="frameShape">\r
+ <enum>QFrame::NoFrame</enum>\r
+ </property>\r
+ <property name="verticalScrollBarPolicy">\r
+ <enum>Qt::ScrollBarAlwaysOff</enum>\r
+ </property>\r
+ <property name="horizontalScrollBarPolicy">\r
+ <enum>Qt::ScrollBarAlwaysOff</enum>\r
+ </property>\r
+ </widget>\r
+ </item>\r
+ </layout>\r
+ </widget>\r
+ </item>\r
+ <item>\r
+ <spacer name="verticalSpacer_2">\r
+ <property name="orientation">\r
+ <enum>Qt::Vertical</enum>\r
+ </property>\r
+ <property name="sizeHint" stdset="0">\r
+ <size>\r
+ <width>20</width>\r
+ <height>40</height>\r
+ </size>\r
+ </property>\r
+ </spacer>\r
+ </item>\r
+ </layout>\r
+ </item>\r
+ </layout>\r
+ </widget>\r
+ <resources/>\r
+ <connections/>\r
+</ui>\r
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="102"/>
- <source>WARNING: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR NovaCoinS</b>!
+ <source>WARNING: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!
Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"></translation>
</message>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="102"/>
- <source>WARNING: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR NovaCoinS</b>!
+ <source>WARNING: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!
Are you sure you wish to encrypt your wallet?</source>
- <translation>ВНИМАНИЕ: Если вы зашифруете бумажник и потеряете свой \200b\200bпароль, вы <b>ПОТЕРЯЕТЕ ВСЕ ВАШИ БИТКОИНЫ!</b>
+ <translation>ВНИМАНИЕ: Если вы зашифруете бумажник и потеряете свой \200b\200bпароль, вы <b>ПОТЕРЯЕТЕ ВСЕ ВАШИ МОНЕТЫ!</b>
Вы действительно хотите зашифровать ваш бумажник?</translation>
</message>
<message>
// ppcoin version - intended for display purpose ONLY
#define PPCOIN_VERSION_MAJOR 0
#define PPCOIN_VERSION_MINOR 3
-#define PPCOIN_VERSION_REVISION 4
+#define PPCOIN_VERSION_REVISION 5
#define PPCOIN_VERSION_BUILD 0
//
// network protocol versioning
//
-static const int PROTOCOL_VERSION = 60004;
+static const int PROTOCOL_VERSION = 60005;
// earlier versions not supported as of Feb 2012, and are disconnected
// NOTE: as of bitcoin v0.6 message serialization (vSend, vRecv) still