Add files via upload
This commit is contained in:
parent
6ef02eb11a
commit
4d39a67e84
|
@ -1,7 +1,6 @@
|
||||||
DIST_SUBDIRS = secp256k1
|
DIST_SUBDIRS = secp256k1
|
||||||
AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS)
|
AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS)
|
||||||
|
|
||||||
|
|
||||||
if EMBEDDED_LEVELDB
|
if EMBEDDED_LEVELDB
|
||||||
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
|
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
|
||||||
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/helpers/memenv
|
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/helpers/memenv
|
||||||
|
@ -84,7 +83,6 @@ LIBZCASH_H = \
|
||||||
# bitcoin core #
|
# bitcoin core #
|
||||||
BITCOIN_CORE_H = \
|
BITCOIN_CORE_H = \
|
||||||
addrman.h \
|
addrman.h \
|
||||||
alert.h \
|
|
||||||
amount.h \
|
amount.h \
|
||||||
arith_uint256.h \
|
arith_uint256.h \
|
||||||
asyncrpcoperation.h \
|
asyncrpcoperation.h \
|
||||||
|
@ -193,9 +191,7 @@ libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
|
||||||
# server: shared between bitcoind and bitcoin-qt
|
# server: shared between bitcoind and bitcoin-qt
|
||||||
libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS)
|
libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS)
|
||||||
libbitcoin_server_a_SOURCES = \
|
libbitcoin_server_a_SOURCES = \
|
||||||
sendalert.cpp \
|
|
||||||
addrman.cpp \
|
addrman.cpp \
|
||||||
alert.cpp \
|
|
||||||
alertkeys.h \
|
alertkeys.h \
|
||||||
asyncrpcoperation.cpp \
|
asyncrpcoperation.cpp \
|
||||||
asyncrpcqueue.cpp \
|
asyncrpcqueue.cpp \
|
||||||
|
|
|
@ -35,7 +35,7 @@ JSON_TEST_FILES = \
|
||||||
test/data/g1_compressed.json \
|
test/data/g1_compressed.json \
|
||||||
test/data/g2_compressed.json
|
test/data/g2_compressed.json
|
||||||
|
|
||||||
RAW_TEST_FILES = test/data/alertTests.raw
|
RAW_TEST_FILES =
|
||||||
|
|
||||||
GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h)
|
GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h)
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ public:
|
||||||
pchMessageStart[1] = 0xe9;
|
pchMessageStart[1] = 0xe9;
|
||||||
pchMessageStart[2] = 0x27;
|
pchMessageStart[2] = 0x27;
|
||||||
pchMessageStart[3] = 0x64;
|
pchMessageStart[3] = 0x64;
|
||||||
vAlertPubKey = ParseHex("048679fb891b15d0cada9692047fd0ae26ad8bfb83fabddbb50334ee5bc0683294deb410be20513c5af6e7b9cec717ade82b27080ee6ef9a245c36a795ab044bb3");
|
|
||||||
nDefaultPort = 8133;
|
nDefaultPort = 8133;
|
||||||
nMinerThreads = 0;
|
nMinerThreads = 0;
|
||||||
nMaxTipAge = 24 * 60 * 60;
|
nMaxTipAge = 24 * 60 * 60;
|
||||||
|
@ -213,7 +212,6 @@ public:
|
||||||
pchMessageStart[1] = 0x1a;
|
pchMessageStart[1] = 0x1a;
|
||||||
pchMessageStart[2] = 0xf9;
|
pchMessageStart[2] = 0xf9;
|
||||||
pchMessageStart[3] = 0xbf;
|
pchMessageStart[3] = 0xbf;
|
||||||
vAlertPubKey = ParseHex("044e7a1553392325c871c5ace5d6ad73501c66f4c185d6b0453cf45dec5a1322e705c672ac1a27ef7cdaf588c10effdf50ed5f95f85f2f54a5f6159fca394ed0c6");
|
|
||||||
nDefaultPort = 18233;
|
nDefaultPort = 18233;
|
||||||
nMinerThreads = 0;
|
nMinerThreads = 0;
|
||||||
nPruneAfterHeight = 1000;
|
nPruneAfterHeight = 1000;
|
||||||
|
|
|
@ -50,7 +50,6 @@ public:
|
||||||
|
|
||||||
const Consensus::Params& GetConsensus() const { return consensus; }
|
const Consensus::Params& GetConsensus() const { return consensus; }
|
||||||
const CMessageHeader::MessageStartChars& MessageStart() const { return pchMessageStart; }
|
const CMessageHeader::MessageStartChars& MessageStart() const { return pchMessageStart; }
|
||||||
const std::vector<unsigned char>& AlertKey() const { return vAlertPubKey; }
|
|
||||||
int GetDefaultPort() const { return nDefaultPort; }
|
int GetDefaultPort() const { return nDefaultPort; }
|
||||||
|
|
||||||
/** Used if GenerateBitcoins is called with a negative number of threads */
|
/** Used if GenerateBitcoins is called with a negative number of threads */
|
||||||
|
@ -89,8 +88,6 @@ protected:
|
||||||
|
|
||||||
Consensus::Params consensus;
|
Consensus::Params consensus;
|
||||||
CMessageHeader::MessageStartChars pchMessageStart;
|
CMessageHeader::MessageStartChars pchMessageStart;
|
||||||
//! Raw pub key bytes for the broadcast alert signing key.
|
|
||||||
std::vector<unsigned char> vAlertPubKey;
|
|
||||||
int nDefaultPort = 0;
|
int nDefaultPort = 0;
|
||||||
int nMinerThreads = 0;
|
int nMinerThreads = 0;
|
||||||
long nMaxTipAge = 0;
|
long nMaxTipAge = 0;
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
extern void ThreadSendAlert();
|
|
||||||
|
|
||||||
ZCJoinSplit* pzcashParams = NULL;
|
ZCJoinSplit* pzcashParams = NULL;
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
|
@ -276,7 +274,6 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||||
|
|
||||||
string strUsage = HelpMessageGroup(_("Options:"));
|
string strUsage = HelpMessageGroup(_("Options:"));
|
||||||
strUsage += HelpMessageOpt("-?", _("This help message"));
|
strUsage += HelpMessageOpt("-?", _("This help message"));
|
||||||
strUsage += HelpMessageOpt("-alerts", strprintf(_("Receive and display P2P network alerts (default: %u)"), DEFAULT_ALERTS));
|
|
||||||
strUsage += HelpMessageOpt("-alertnotify=<cmd>", _("Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)"));
|
strUsage += HelpMessageOpt("-alertnotify=<cmd>", _("Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)"));
|
||||||
strUsage += HelpMessageOpt("-blocknotify=<cmd>", _("Execute command when the best block changes (%s in cmd is replaced by block hash)"));
|
strUsage += HelpMessageOpt("-blocknotify=<cmd>", _("Execute command when the best block changes (%s in cmd is replaced by block hash)"));
|
||||||
strUsage += HelpMessageOpt("-checkblocks=<n>", strprintf(_("How many blocks to check at startup (default: %u, 0 = all)"), 288));
|
strUsage += HelpMessageOpt("-checkblocks=<n>", strprintf(_("How many blocks to check at startup (default: %u, 0 = all)"), 288));
|
||||||
|
@ -915,8 +912,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", true);
|
fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", true);
|
||||||
nMaxDatacarrierBytes = GetArg("-datacarriersize", nMaxDatacarrierBytes);
|
nMaxDatacarrierBytes = GetArg("-datacarriersize", nMaxDatacarrierBytes);
|
||||||
|
|
||||||
fAlerts = GetBoolArg("-alerts", DEFAULT_ALERTS);
|
|
||||||
|
|
||||||
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
|
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
|
||||||
|
|
||||||
// Initialize libsodium
|
// Initialize libsodium
|
||||||
|
@ -1515,8 +1510,5 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SENDALERT
|
|
||||||
threadGroup.create_thread(boost::bind(ThreadSendAlert));
|
|
||||||
|
|
||||||
return !fRequestShutdown;
|
return !fRequestShutdown;
|
||||||
}
|
}
|
||||||
|
|
95
src/main.cpp
95
src/main.cpp
|
@ -8,7 +8,6 @@
|
||||||
#include "sodium.h"
|
#include "sodium.h"
|
||||||
|
|
||||||
#include "addrman.h"
|
#include "addrman.h"
|
||||||
#include "alert.h"
|
|
||||||
#include "arith_uint256.h"
|
#include "arith_uint256.h"
|
||||||
#include "chainparams.h"
|
#include "chainparams.h"
|
||||||
#include "checkpoints.h"
|
#include "checkpoints.h"
|
||||||
|
@ -67,7 +66,6 @@ bool fCheckpointsEnabled = true;
|
||||||
bool fCoinbaseEnforcedProtectionEnabled = true;
|
bool fCoinbaseEnforcedProtectionEnabled = true;
|
||||||
size_t nCoinCacheUsage = 5000 * 300;
|
size_t nCoinCacheUsage = 5000 * 300;
|
||||||
uint64_t nPruneTarget = 0;
|
uint64_t nPruneTarget = 0;
|
||||||
bool fAlerts = DEFAULT_ALERTS;
|
|
||||||
|
|
||||||
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying and mining) */
|
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying and mining) */
|
||||||
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
|
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
|
||||||
|
@ -1424,6 +1422,26 @@ bool fLargeWorkForkFound = false;
|
||||||
bool fLargeWorkInvalidChainFound = false;
|
bool fLargeWorkInvalidChainFound = false;
|
||||||
CBlockIndex *pindexBestForkTip = NULL, *pindexBestForkBase = NULL;
|
CBlockIndex *pindexBestForkTip = NULL, *pindexBestForkBase = NULL;
|
||||||
|
|
||||||
|
static void AlertNotify(const std::string& strMessage, bool fThread)
|
||||||
|
{
|
||||||
|
uiInterface.NotifyAlertChanged();
|
||||||
|
std::string strCmd = GetArg("-alertnotify", "");
|
||||||
|
if (strCmd.empty()) return;
|
||||||
|
|
||||||
|
// Alert text should be plain ascii coming from a trusted source, but to
|
||||||
|
// be safe we first strip anything not in safeChars, then add single quotes around
|
||||||
|
// the whole string before passing it to the shell:
|
||||||
|
std::string singleQuote("'");
|
||||||
|
std::string safeStatus = SanitizeString(strMessage);
|
||||||
|
safeStatus = singleQuote+safeStatus+singleQuote;
|
||||||
|
boost::replace_all(strCmd, "%s", safeStatus);
|
||||||
|
|
||||||
|
if (fThread)
|
||||||
|
boost::thread t(runCommand, strCmd); // thread runs free
|
||||||
|
else
|
||||||
|
runCommand(strCmd);
|
||||||
|
}
|
||||||
|
|
||||||
void CheckForkWarningConditions()
|
void CheckForkWarningConditions()
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
|
@ -1443,7 +1461,7 @@ void CheckForkWarningConditions()
|
||||||
{
|
{
|
||||||
std::string warning = std::string("'Warning: Large-work fork detected, forking after block ") +
|
std::string warning = std::string("'Warning: Large-work fork detected, forking after block ") +
|
||||||
pindexBestForkBase->phashBlock->ToString() + std::string("'");
|
pindexBestForkBase->phashBlock->ToString() + std::string("'");
|
||||||
CAlert::Notify(warning, true);
|
AlertNotify(warning, true);
|
||||||
}
|
}
|
||||||
if (pindexBestForkTip && pindexBestForkBase)
|
if (pindexBestForkTip && pindexBestForkBase)
|
||||||
{
|
{
|
||||||
|
@ -1456,7 +1474,7 @@ void CheckForkWarningConditions()
|
||||||
{
|
{
|
||||||
std::string warning = std::string("Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.");
|
std::string warning = std::string("Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.");
|
||||||
LogPrintf("%s: %s\n", warning.c_str(), __func__);
|
LogPrintf("%s: %s\n", warning.c_str(), __func__);
|
||||||
CAlert::Notify(warning, true);
|
AlertNotify(warning, true);
|
||||||
fLargeWorkInvalidChainFound = true;
|
fLargeWorkInvalidChainFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2025,7 +2043,7 @@ void PartitionCheck(bool (*initialDownloadCheck)(), CCriticalSection& cs, const
|
||||||
if (!strWarning.empty())
|
if (!strWarning.empty())
|
||||||
{
|
{
|
||||||
strMiscWarning = strWarning;
|
strMiscWarning = strWarning;
|
||||||
CAlert::Notify(strWarning, true);
|
AlertNotify(strWarning, true);
|
||||||
lastAlertTime = now;
|
lastAlertTime = now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2386,7 +2404,7 @@ void static UpdateTip(CBlockIndex *pindexNew) {
|
||||||
{
|
{
|
||||||
// strMiscWarning is read by GetWarnings(), called by Qt and the JSON-RPC code to warn the user:
|
// strMiscWarning is read by GetWarnings(), called by Qt and the JSON-RPC code to warn the user:
|
||||||
strMiscWarning = _("Warning: This version is obsolete; upgrade required!");
|
strMiscWarning = _("Warning: This version is obsolete; upgrade required!");
|
||||||
CAlert::Notify(strMiscWarning, true);
|
AlertNotify(strMiscWarning, true);
|
||||||
fWarned = true;
|
fWarned = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4029,14 +4047,8 @@ void static CheckBlockIndex()
|
||||||
assert(nNodes == forward.size());
|
assert(nNodes == forward.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// CAlert
|
|
||||||
//
|
|
||||||
|
|
||||||
string GetWarnings(string strFor)
|
string GetWarnings(string strFor)
|
||||||
{
|
{
|
||||||
int nPriority = 0;
|
|
||||||
string strStatusBar;
|
string strStatusBar;
|
||||||
string strRPC;
|
string strRPC;
|
||||||
|
|
||||||
|
@ -4049,38 +4061,18 @@ string GetWarnings(string strFor)
|
||||||
// Misc warnings like out of disk space and clock is wrong
|
// Misc warnings like out of disk space and clock is wrong
|
||||||
if (strMiscWarning != "")
|
if (strMiscWarning != "")
|
||||||
{
|
{
|
||||||
nPriority = 1000;
|
|
||||||
strStatusBar = strMiscWarning;
|
strStatusBar = strMiscWarning;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fLargeWorkForkFound)
|
if (fLargeWorkForkFound)
|
||||||
{
|
{
|
||||||
nPriority = 2000;
|
|
||||||
strStatusBar = strRPC = _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.");
|
strStatusBar = strRPC = _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.");
|
||||||
}
|
}
|
||||||
else if (fLargeWorkInvalidChainFound)
|
else if (fLargeWorkInvalidChainFound)
|
||||||
{
|
{
|
||||||
nPriority = 2000;
|
|
||||||
strStatusBar = strRPC = _("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade.");
|
strStatusBar = strRPC = _("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alerts
|
|
||||||
{
|
|
||||||
LOCK(cs_mapAlerts);
|
|
||||||
BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
|
|
||||||
{
|
|
||||||
const CAlert& alert = item.second;
|
|
||||||
if (alert.AppliesToMe() && alert.nPriority > nPriority)
|
|
||||||
{
|
|
||||||
nPriority = alert.nPriority;
|
|
||||||
strStatusBar = alert.strStatusBar;
|
|
||||||
if (alert.nPriority >= ALERT_PRIORITY_SAFE_MODE) {
|
|
||||||
strRPC = alert.strRPCError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strFor == "statusbar")
|
if (strFor == "statusbar")
|
||||||
return strStatusBar;
|
return strStatusBar;
|
||||||
else if (strFor == "rpc")
|
else if (strFor == "rpc")
|
||||||
|
@ -4375,13 +4367,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Relay alerts
|
|
||||||
{
|
|
||||||
LOCK(cs_mapAlerts);
|
|
||||||
BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
|
|
||||||
item.second.RelayTo(pfrom);
|
|
||||||
}
|
|
||||||
|
|
||||||
pfrom->fSuccessfullyConnected = true;
|
pfrom->fSuccessfullyConnected = true;
|
||||||
|
|
||||||
string remoteAddr;
|
string remoteAddr;
|
||||||
|
@ -4990,38 +4975,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (fAlerts && strCommand == "alert")
|
|
||||||
{
|
|
||||||
CAlert alert;
|
|
||||||
vRecv >> alert;
|
|
||||||
|
|
||||||
uint256 alertHash = alert.GetHash();
|
|
||||||
if (pfrom->setKnown.count(alertHash) == 0)
|
|
||||||
{
|
|
||||||
if (alert.ProcessAlert(Params().AlertKey()))
|
|
||||||
{
|
|
||||||
// Relay
|
|
||||||
pfrom->setKnown.insert(alertHash);
|
|
||||||
{
|
|
||||||
LOCK(cs_vNodes);
|
|
||||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
|
||||||
alert.RelayTo(pnode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Small DoS penalty so peers that send us lots of
|
|
||||||
// duplicate/expired/invalid-signature/whatever alerts
|
|
||||||
// eventually get banned.
|
|
||||||
// This isn't a Misbehaving(100) (immediate ban) because the
|
|
||||||
// peer might be an older or different implementation with
|
|
||||||
// a different signature key, etc.
|
|
||||||
Misbehaving(pfrom->GetId(), 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
else if (strCommand == "filterload")
|
else if (strCommand == "filterload")
|
||||||
{
|
{
|
||||||
CBloomFilter filter;
|
CBloomFilter filter;
|
||||||
|
|
|
@ -52,8 +52,6 @@ static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 750000;
|
||||||
static const unsigned int DEFAULT_BLOCK_MIN_SIZE = 0;
|
static const unsigned int DEFAULT_BLOCK_MIN_SIZE = 0;
|
||||||
/** Default for -blockprioritysize, maximum space for zero/low-fee transactions **/
|
/** Default for -blockprioritysize, maximum space for zero/low-fee transactions **/
|
||||||
static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 50000;
|
static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 50000;
|
||||||
/** Default for accepting alerts from the P2P network. */
|
|
||||||
static const bool DEFAULT_ALERTS = true;
|
|
||||||
/** Minimum alert priority for enabling safe mode. */
|
/** Minimum alert priority for enabling safe mode. */
|
||||||
static const int ALERT_PRIORITY_SAFE_MODE = 4000;
|
static const int ALERT_PRIORITY_SAFE_MODE = 4000;
|
||||||
/** Maximum number of signature check operations in an IsStandard() P2SH script */
|
/** Maximum number of signature check operations in an IsStandard() P2SH script */
|
||||||
|
@ -124,7 +122,6 @@ extern bool fCheckpointsEnabled;
|
||||||
extern bool fCoinbaseEnforcedProtectionEnabled;
|
extern bool fCoinbaseEnforcedProtectionEnabled;
|
||||||
extern size_t nCoinCacheUsage;
|
extern size_t nCoinCacheUsage;
|
||||||
extern CFeeRate minRelayTxFee;
|
extern CFeeRate minRelayTxFee;
|
||||||
extern bool fAlerts;
|
|
||||||
|
|
||||||
/** Best header we've seen so far (used for getheaders queries' starting points). */
|
/** Best header we've seen so far (used for getheaders queries' starting points). */
|
||||||
extern CBlockIndex *pindexBestHeader;
|
extern CBlockIndex *pindexBestHeader;
|
||||||
|
|
Loading…
Reference in New Issue