Commit c4e1270d authored by Zhenzhen Zhan's avatar Zhenzhen Zhan

Merge tag 'v0.13.4.0' into bitcore

parents f9a15916 bf750d36
Pipeline #1052 failed with stage
in 31 minutes
variables:
RELEASE_VERSION: "0.13.2.0"
RELEASE_VERSION: "0.13.4.0"
GIT_STRATEGY: "clone"
MAKEJOBS: "-j4"
CCACHE_SIZE: "100M"
......
This is a bitcore-specific Crown Core. For details see "doc/bitcore.md".
# Crown Platform 0.13.0
# Crown Platform 0.13.4
[![pipeline status](http://gitlab.crown.tech/crown/crown-core/badges/master/pipeline.svg)](http://gitlab.crown.tech/crown/crown-core/commits/master)
......
......@@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 13)
define(_CLIENT_VERSION_REVISION, 2)
define(_CLIENT_VERSION_REVISION, 4)
define(_CLIENT_VERSION_BUILD, 0)
define(_COPYRIGHT_YEAR, 2019)
AC_INIT([Crown Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[[email protected]],[crown])
......
This diff is collapsed.
# Crown v0.13.4 Release Notes
Crown Core v0.13.4 is a minor release and a recommended upgrade.
It is available for download from:
https://crown.tech/downloads
Please report bugs through the Help, Guides and Support board at the
Crown forum
https://forum.crown.tech/index.php?board=5.0
## How to upgrade
The basic procedure is to shutdown your existing version, replace the
executable with the new version, and restart. This is true for both wallets
and masternodes/systemnodes. The exact procedure depends on how you setup
the wallet and/or node in the first place. If you use a managed hosting
service for your node(s) it is probable they will upgrade them for you,
but you will need to upgrade your wallet. There is no protocol version
change in this release so if your MN/SN is updated quickly enough it will
remain active and you won't need to isue a start-alias for it.
## What's new
v0.13.4 features 5 main changes over the previous v0.13.2.0 version:
* sync problem fixed
* immature MN/SN rewards and staking rewards show as immature in the
wallet overview
* address labels from before v0.13 display correctly
* reduced memory usage
* enhancements to the installation script and the watchdog script is
now part of the release
......@@ -3,11 +3,11 @@
Crown Core v0.13.0 is a major release and a mandatory upgrade.
It is available for download from:
[](https://crown.tech/downloads)
https://crown.tech/downloads
Please report bugs using the issue tracker at Gitlab:
[](https://gitlab.crown.tech/crown/crown-core/issues/new?issue%5Bassignee_id%5D=&issue%5Bmilestone_id%5D=)
https://gitlab.crown.tech/crown/crown-core/issues/new?issue%5Bassignee_id%5D=&issue%5Bmilestone_id%5D=
## How to upgrade
......@@ -101,7 +101,7 @@ coins are eligible to earn rewards. Therefore the minimum wallet balance which
can stake is 500 coins and those coins must be locked as the collateral for a
systemnode.
The system is described in more detail in [Crown-MNPoS.md](https://gitlab.crown.tech/walkjivefly/crown-core/blob/v0.13_preparation/doc/Crown-masternode-Proof-of-Stake-consensus-overview.md)
The system is described in more detail in [Crown-MNPoS.md](https://gitlab.crown.tech/crown/crown-core/blob/master/doc/Crown-MNPoS.md)
### The switchover
The switchover from PoW to PoS will take place at block height 2330000, approximately
......
This diff is collapsed.
#!/bin/bash
# Copyright (c) 2018-2019 The Crown developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# crownwatch.sh
# A watchdog program to alleviate problems caused by increased memory
# usage of the Crown daemon.
#
# It does 2 things:
# 1. Check if crownd is running and start it if not
# 2. If started with "mem" option, check how much memory is free and
# pre-emptively restart the daemon if it is judged too low. The
# default amount is rather arbitrary and may not be appropriate
# for everyone. That's why it is easily configurable a few lines
# down from here where it says MINFREE=524288
#
# These are referred to as watchdog levels 1 and 2 by the
# crown-server-install.sh installation/update script.
#
# It is expected to be installed as /usr/local/bin/crownwatch.sh and
# executed by whichever userid runs the daemon on your system, by cron
# every 15 minutes. If you installed it manually, or want to change the
# watchdog level, add either one of the following (uncommented) lines
# to make it so:
#
# */15 * * * * /usr/local/bin/crownwatch.sh
# */15 * * * * /usr/local/bin/crownwatch.sh mem
#
# Customise these to suit your environment
MINFREE=524288 # safe minimum free memory
PREFIX="/usr/local/bin" # path to Crown executables
DATADIR=~/.crown # Crown datadir
# Announce ourselves
echo "Crown watchdog script running at" `date`
# Start off by looking for running daemon
PID=$(pidof crownd)
# Start it if it's not running
if [[ $? -eq 1 ]]; then
echo "crownd not running. Removing any old flags and starting it."
rm -f "${DATADIR}/crownd.pid" "${DATADIR}/.lock"
${PREFIX}/crownd -daemon
# Daemon is running, check free memory if requested by the user
elif [[ $1 == "mem" ]]; then
echo "crownd running with PID=${PID}. Checking free memory."
TMP=$("mktemp")
free > ${TMP}
FREEMEM=$(awk '$1 ~ /Mem|Swap/ {sum += $4} END {print sum}' ${TMP})
rm ${TMP}
# If free memory is getting low, pre-emptively stop the daemon
if [[ ${FREEMEM} -lt ${MINFREE} ]]; then
echo "Total free memory is less than minimum. Shutting down crownd."
${PREFIX}/crown-cli stop
# Allow up to 10 minutes for it to shutdown gracefully
for ((i=0; i<10; i++)); do
echo "...waiting..."
sleep 60
if [[ $(ps -p ${PID} | wc -l) -lt 2 ]]; then
break
fi
done
# If it still hasn't shutdown, terminate with extreme prejudice
if [[ ${i} -eq 10 ]]; then
echo "Shutdown still incomplete, killing the daemon."
kill -9 ${PID}
sleep 10
rm -f "${DATADIR}/crownd.pid" "${DATADIR}/.lock"
fi
# Restart it if we stopped it
echo "Starting crownd."
${PREFIX}/crownd -daemon
# Nothing to do if there was enough free memory
else
echo "Total free memory is above safe minimum, doing nothing."
fi
fi
......@@ -16,7 +16,7 @@
//! These need to be macros, as clientversion.cpp's and crown*-res.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 13
#define CLIENT_VERSION_REVISION 2
#define CLIENT_VERSION_REVISION 4
#define CLIENT_VERSION_BUILD 0
/**
......
This diff is collapsed.
......@@ -4,11 +4,11 @@
#define REQUIRED_WITNESS_SIGS 6
#define STAKE_REPACKAGE_THRESHOLD 3
void ProofTracker::AddNewStake(const STAKEHASH& hashStake, const BLOCKHASH& hashBlock)
void ProofTracker::AddNewStake(const STAKEHASH& hashStake, const BLOCKHASH& hashBlock, int nHeight)
{
if (!m_mapStakes.count(hashStake))
m_mapStakes.emplace(std::make_pair(hashStake, std::set<BLOCKHASH>()));
m_mapStakes.at(hashStake).emplace(hashBlock);
m_mapStakes.emplace(std::make_pair(hashStake, std::make_pair(nHeight, std::set<BLOCKHASH>())));
m_mapStakes.at(hashStake).second.emplace(hashBlock);
}
void ProofTracker::AddWitness(const BlockWitness& witness)
......@@ -37,14 +37,14 @@ bool ProofTracker::HasSufficientProof(const BLOCKHASH& hashBlock) const
return m_mapBlockWitness.count(hashBlock) && m_mapBlockWitness.at(hashBlock).size() >= REQUIRED_WITNESS_SIGS;
}
bool ProofTracker::IsSuspicious(const STAKEHASH& hashStake, const BLOCKHASH& hashBlock)
bool ProofTracker::IsSuspicious(const STAKEHASH& hashStake, const BLOCKHASH& hashBlock, int nHeight)
{
if (!m_mapStakes.count(hashStake)) {
AddNewStake(hashStake, hashBlock);
AddNewStake(hashStake, hashBlock, nHeight);
return false;
}
if (m_mapStakes.at(hashStake).size() >= STAKE_REPACKAGE_THRESHOLD) {
if (m_mapStakes.at(hashStake).second.size() >= STAKE_REPACKAGE_THRESHOLD) {
//If there are enough masternode that has signed off on this hash then it is not suspicious
if (!m_mapBlockWitness.count(hashBlock))
return true; //suspicious because no records of mn signing this block
......@@ -58,6 +58,27 @@ bool ProofTracker::IsSuspicious(const STAKEHASH& hashStake, const BLOCKHASH& has
//Not suspicious, but still record knowledge of this stake so potential suspicious repackaging of this stake
//can be tracked
AddNewStake(hashStake, hashBlock);
AddNewStake(hashStake, hashBlock, nHeight);
return false;
}
void ProofTracker::EraseBeforeHeight(int nHeight)
{
std::set<uint256> setErase;
for (const auto& p : m_mapStakes) {
int nBlockHeight = p.second.first;
if (nBlockHeight < nHeight) {
setErase.emplace(p.first);
//Erase all witnesses associated with this stake hash
const std::set<BLOCKHASH>& setWitness = p.second.second;
for (const uint256& hashBlock : setWitness) {
m_mapBlockWitness.erase(hashBlock);
}
}
}
for (const uint256& hashStake : setErase) {
m_mapStakes.erase(hashStake);
}
}
\ No newline at end of file
......@@ -10,14 +10,15 @@ typedef uint256 STAKEHASH;
class ProofTracker
{
private:
std::map<STAKEHASH, std::set<BLOCKHASH>> m_mapStakes;
std::map<STAKEHASH, std::pair<int, std::set<BLOCKHASH> > > m_mapStakes; // {stakehash => [height, blockhash]}
std::map<BLOCKHASH, std::set<BlockWitness>> m_mapBlockWitness;
void AddNewStake(const STAKEHASH& hashStake, const BLOCKHASH& hashBlock);
void AddNewStake(const STAKEHASH& hashStake, const BLOCKHASH& hashBlock, int nHeight);
public:
std::set<BlockWitness> GetWitnesses(const uint256& hashBlock) const;
bool HasSufficientProof(const BLOCKHASH& hashBlock) const;
bool IsSuspicious(const STAKEHASH& hash, const BLOCKHASH& hashBlock);
bool IsSuspicious(const STAKEHASH& hash, const BLOCKHASH& hashBlock, int nHeight);
void AddWitness(const BlockWitness& witness);
int GetWitnessCount(const BLOCKHASH& hashBlock) const;
void EraseBeforeHeight(int nHeight);
};
\ No newline at end of file
......@@ -2084,6 +2084,7 @@ CNode::CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn, bool fIn
fPingQueued = false;
fMasternode = false;
fSystemnode = false;
fSyncingWith = false;
{
LOCK(cs_nLastNodeId);
......@@ -2115,6 +2116,13 @@ CNode::~CNode()
GetNodeSignals().FinalizeNode(GetId());
}
void CNode::AskForBlock(const CInv& inv)
{
if (listAskForBlocks.size() > MAPASKFOR_MAX_SZ)
return;
listAskForBlocks.emplace_back(inv);
}
void CNode::AskFor(const CInv& inv)
{
if (mapAskFor.size() > MAPASKFOR_MAX_SZ)
......
......@@ -301,12 +301,14 @@ public:
mruset<CAddress> setAddrKnown;
bool fGetAddr;
std::set<uint256> setKnown;
bool fSyncingWith;
// inventory based relay
mruset<CInv> setInventoryKnown;
std::vector<CInv> vInventoryToSend;
CCriticalSection cs_inventory;
std::multimap<int64_t, CInv> mapAskFor;
std::list<CInv> listAskForBlocks;
std::set<uint256> setBlockAskedFor;
// Ping time measurement:
......@@ -415,6 +417,7 @@ public:
}
void AskFor(const CInv& inv);
void AskForBlock(const CInv& inv);
// TODO: Document the postcondition of this function. Is cs_vSend locked?
void BeginMessage(const char* pszCommand) EXCLUSIVE_LOCK_FUNCTION(cs_vSend);
......
......@@ -849,7 +849,9 @@ void BitcoinGUI::setNumBlocks(int count)
QString tooltip;
QDateTime lastBlockDate = clientModel->getLastBlockDate();
int nHeight = 0;
QDateTime lastBlockDate;
clientModel->getLastBlockData(lastBlockDate, nHeight);
QDateTime currentDate = QDateTime::currentDateTime();
int secs = lastBlockDate.secsTo(currentDate);
......@@ -933,7 +935,7 @@ void BitcoinGUI::setNumBlocks(int count)
}
progressBarLabel->setVisible(true);
progressBar->setFormat(tr("%1 behind").arg(timeBehindText));
progressBar->setFormat(tr("%1 behind. Last synced block: %2").arg(timeBehindText).arg(QString::number(nHeight)));
progressBar->setMaximum(1000000000);
progressBar->setValue(clientModel->getVerificationProgress() * 1000000000.0 + 0.5);
progressBar->setVisible(true);
......
......@@ -112,13 +112,16 @@ quint64 ClientModel::getTotalBytesSent() const
return CNode::GetTotalBytesSent();
}
QDateTime ClientModel::getLastBlockDate() const
void ClientModel::getLastBlockData(QDateTime& date, int& nHeight) const
{
LOCK(cs_main);
if (chainActive.Tip())
return QDateTime::fromTime_t(chainActive.Tip()->GetBlockTime());
else
return QDateTime::fromTime_t(Params().GenesisBlock().GetBlockTime()); // Genesis block's time of current network
if (chainActive.Tip()) {
date = QDateTime::fromTime_t(chainActive.Tip()->GetBlockTime());
nHeight = chainActive.Height();
} else {
date = QDateTime::fromTime_t(Params().GenesisBlock().GetBlockTime()); // Genesis block's time of current network
nHeight = 0;
}
}
double ClientModel::getVerificationProgress() const
......
......@@ -58,7 +58,7 @@ public:
quint64 getTotalBytesSent() const;
double getVerificationProgress() const;
QDateTime getLastBlockDate() const;
void getLastBlockData(QDateTime& date, int& nHeight) const;
//! Return true if core is doing initial block download
bool inInitialBlockDownload() const;
......
......@@ -485,8 +485,12 @@ void RPCConsole::setNumConnections(int count)
void RPCConsole::setNumBlocks(int count)
{
ui->numberOfBlocks->setText(QString::number(count));
if(clientModel)
ui->lastBlockTime->setText(clientModel->getLastBlockDate().toString());
if(clientModel) {
QDateTime dt;
int nHeight;
clientModel->getLastBlockData(dt, nHeight);
ui->lastBlockTime->setText(dt.toString());
}
}
void RPCConsole::setMasternodeCount(const QString &strMasternodes)
......
......@@ -18,7 +18,7 @@
*/
bool TransactionRecord::showTransaction(const CWalletTx &wtx)
{
if (wtx.IsCoinBase())
if (wtx.IsCoinBase() || wtx.IsCoinStake())
{
// Ensures we show generated coins / mined transactions at depth 1
if (!wtx.IsInMainChain())
......@@ -187,7 +187,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
// Sort order, unrecorded transactions sort to the top
status.sortKey = strprintf("%010d-%01d-%010u-%03d",
(pindex ? pindex->nHeight : std::numeric_limits<int>::max()),
(wtx.IsCoinBase() ? 1 : 0),
((wtx.IsCoinBase() || wtx.IsCoinStake()) ? 1 : 0),
wtx.nTimeReceived,
idx);
status.countsForBalance = wtx.IsTrusted() && !(wtx.GetBlocksToMaturity() > 0);
......
......@@ -725,7 +725,7 @@ public:
CAmount GetCredit(const isminefilter& filter) const
{
// Must wait until coinbase is safely deep enough in the chain before valuing it
if (IsCoinBase() && GetBlocksToMaturity() > 0)
if ((IsCoinBase() || IsCoinStake()) && GetBlocksToMaturity() > 0)
return 0;
int64_t credit = 0;
......@@ -757,7 +757,7 @@ public:
CAmount GetImmatureCredit(bool fUseCache=true) const
{
if (IsCoinBase() && GetBlocksToMaturity() > 0 && IsInMainChain())
if ((IsCoinBase() || IsCoinStake()) && GetBlocksToMaturity() > 0 && IsInMainChain())
{
if (fUseCache && fImmatureCreditCached)
return nImmatureCreditCached;
......@@ -775,7 +775,7 @@ public:
return 0;
// Must wait until coinbase is safely deep enough in the chain before valuing it
if (IsCoinBase() && GetBlocksToMaturity() > 0)
if ((IsCoinBase() || IsCoinStake()) && GetBlocksToMaturity() > 0)
return 0;
if (fUseCache && fAvailableCreditCached)
......@@ -801,7 +801,7 @@ public:
CAmount GetImmatureWatchOnlyCredit(const bool& fUseCache=true) const
{
if (IsCoinBase() && GetBlocksToMaturity() > 0 && IsInMainChain())
if ((IsCoinBase() || IsCoinStake()) && GetBlocksToMaturity() > 0 && IsInMainChain())
{
if (fUseCache && fImmatureWatchCreditCached)
return nImmatureWatchCreditCached;
......@@ -819,7 +819,7 @@ public:
return 0;
// Must wait until coinbase is safely deep enough in the chain before valuing it
if (IsCoinBase() && GetBlocksToMaturity() > 0)
if ((IsCoinBase() || IsCoinStake()) && GetBlocksToMaturity() > 0)
return 0;
if (fUseCache && fAvailableWatchCreditCached)
......
......@@ -356,12 +356,20 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
{
string strAddress;
ssKey >> strAddress;
// If the address is not depricated then the value won't be converted
strAddress = CBitcoinAddress::ConvertToNew(strAddress);
ssValue >> pwallet->mapAddressBook[CBitcoinAddress(strAddress).Get()].name;
}
else if (strType == "purpose")
{
string strAddress;
ssKey >> strAddress;
// If the address is not depricated then the value won't be converted
strAddress = CBitcoinAddress::ConvertToNew(strAddress);
ssValue >> pwallet->mapAddressBook[CBitcoinAddress(strAddress).Get()].purpose;
}
else if (strType == "tx")
......
{
"Linux32":{
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.0/Crown-0.13.0.0-Linux32.zip",
"sha256sum":"f823e59204eb608fe16305be2ba8c3c4507d4f38ac9c20b62809e811d663c9b2"
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.2.0/Crown-0.13.2.0-Linux32.zip",
"sha256sum":"4414c09c7a4e7d54e156ae27b462ef3937fa8a7b419e98a9e140852e67cc23a2"
},
"Linux64":{
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.0/Crown-0.13.0.0-Linux64.zip",
"sha256sum":"23cde1605d2f9e1b218a9f6e7aa53df09cece7a628fae072fb921a785f883772"
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.2.0/Crown-0.13.2.0-Linux64.zip",
"sha256sum":"2a578214e7c36db4faed7f48bade32144fc49e7e13267308ebbb15f1612cde3f"
},
"Osx":{
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.0/Crown-0.13.0.0-Osx.zip",
"sha256sum":"efe2c140f26fd43fe4a37dce683b9a55e266c911485613a8bf4c0847fd32d413"
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.2.0/Crown-0.13.2.0-Osx-dmg.zip",
"sha256sum":"21a0737356c7f263db803f5124eff1b889fb547d157a0a56fdbb0b3484072bff"
},
"Win32":{
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.0/Crown-0.13.0.0-Win32.zip",
"sha256sum":"a650dfa4542f1d68cb4180ff08eef4a88644cbb5585a2208b27c746ce9fd1c86"
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.2.0/Crown-0.13.2.0-Win32.zip",
"sha256sum":"31f4165211e4644153f36fe68403b86ee1fa73e5e9a98704c857aba7c7f7faf4"
},
"Win64":{
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.0/Crown-0.13.0.0-Win64.zip",
"sha256sum":"64bc08ac1c129df9e79c8d1d658322372c088967114ab7bfc1ff935065906576"
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.2.0/Crown-0.13.2.0-Win64.zip",
"sha256sum":"f1b52a2a87c2e379f6c42423fb7efde3a471c0774afacbd3cbe8b813b6327e21"
},
"RaspberryPi":{
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.0/Crown-0.13.0.0-RaspberryPi.zip",
"sha256sum":"dc9f1550ebf33583cd1ac5c7b2f5d7df1736f62418fa71d7ed200b2c91c66262"
"Url":"https://github.com/Crowndev/crown-core/releases/download/v0.13.2.0/Crown-0.13.2.0-RaspberryPi.zip",
"sha256sum":"86787472458743a009ef870669348b57461aebc623c07a7d894955914d035424"
},
"Version":130000,
"Version":130200,
"NeedToBeUpdated": true
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment