Skip to content

Commit

Permalink
protocol changes
Browse files Browse the repository at this point in the history
  • Loading branch information
maincryptodev committed Jul 13, 2018
1 parent d760aa1 commit a9b8b50
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 34 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 1)
define(_CLIENT_VERSION_MINOR, 2)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2018)
AC_INIT([CazCoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[www.cazcoin.com],[cazcoin])
AC_INIT([CazCoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[www.cazcoin.io],[cazcoin])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([src/config/cazcoin-config.h])
AC_CONFIG_AUX_DIR([build-aux])
Expand Down
29 changes: 20 additions & 9 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ static Checkpoints::MapCheckpoints mapCheckpoints =
(5000, uint256("0xc702646102e539852d5a1dbc19488ff99078d000ef1a31d7718294037f8c0c91"))
(10000, uint256("0x1cc418c72666736a70c2adf35b1bc5c6fce07aca97b31af45d68761c3ab66912"))
(20000, uint256("0x62a224ea22e767b354f1f0e5854c8f6da85216f22329c0f00a563c6f90351a4d"))
(25550, uint256("0xb790cd6f25351bc9fbc711c58ecd97ea4585702a407ab938d7f09db7e41e4fb2"));
(25550, uint256("0xb790cd6f25351bc9fbc711c58ecd97ea4585702a407ab938d7f09db7e41e4fb2"))
(50000, uint256("0x18979aa918bf457765ecc9d4bbf761a0bfa656f6cb12dd0007e5ceebac811edd"))
(80000, uint256("0x1bdefb98540a6a66da1ae7217e47d45d6de8a36a53869ddc9de869cb50321c26"))
(110000, uint256("0x64532ec3abe8553d7e33b99c2a4db39c95bd674d2cf69d42d7642ab417d1308c"))
(118800, uint256("0x43425e5ea2b977e11ddb9eb27b7ec2d923b5c616c7144b8d259f2cc3ee29732e"));

static const Checkpoints::CCheckpointData data = {
&mapCheckpoints,
1525521668, // * UNIX timestamp of last checkpoint block
1531176411, // * UNIX timestamp of last checkpoint block
0, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
2000 // * estimated number of transactions per day after checkpoint
Expand Down Expand Up @@ -99,7 +103,7 @@ class CMainParams : public CChainParams
nTargetTimespan = 1 * 90;
nTargetSpacing = 1 * 90;
nLastPOWBlock = 2000;
nMaturity = 50;
nMaturity = 100;
nModifierUpdateBlock = 1;

const char* pszTimestamp = "Copico to launch one of it's innovative products on the blockchain";
Expand All @@ -121,10 +125,16 @@ class CMainParams : public CChainParams
assert(hashGenesisBlock == uint256("0x000008fef3a083a36208f4bcf73811d225bf70c0c25fced32b0e457ca75eab59"));
assert(genesis.hashMerkleRoot == uint256("0x7dc06dd8c9bb15f1f4bfd39a96a9be72257b79fd591b67529c887cc8021d30f7"));

vSeeds.push_back(CDNSSeedData("0", "seed1.copico.io"));
vSeeds.push_back(CDNSSeedData("1", "seed2.copico.io"));
vSeeds.push_back(CDNSSeedData("2", "seed3.copico.io"));
vSeeds.push_back(CDNSSeedData("3", "seed4.copico.io"));
vSeeds.push_back(CDNSSeedData("seed1.copico.io", "seed1.copico.io"));
vSeeds.push_back(CDNSSeedData("seed2.copico.io", "seed2.copico.io"));
vSeeds.push_back(CDNSSeedData("seed3.copico.io", "seed3.copico.io"));
vSeeds.push_back(CDNSSeedData("seed4.copico.io", "seed4.copico.io"));
vSeeds.push_back(CDNSSeedData("seed5.copico.io", "seed5.copico.io"));
vSeeds.push_back(CDNSSeedData("seed6.copico.io", "seed6.copico.io"));
vSeeds.push_back(CDNSSeedData("seed7.copico.io", "seed7.copico.io"));
vSeeds.push_back(CDNSSeedData("seed8.copico.io", "seed8.copico.io"));
vSeeds.push_back(CDNSSeedData("seed9.copico.io", "seed9.copico.io"));
vSeeds.push_back(CDNSSeedData("seed10.copico.io", "seed10.copico.io"));

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 28);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 43);
Expand Down Expand Up @@ -177,15 +187,16 @@ class CTestNetParams : public CMainParams
nTargetTimespan = 1 * 60; // CazCoin: 1 day
nTargetSpacing = 1 * 60; // CazCoin: 1 minute
nLastPOWBlock = 200;
nMaturity = 15;
nMaturity = 20;
nModifierUpdateBlock = 1;
//! Modify the testnet genesis block so the timestamp is valid for a later start.
genesis.nTime = 1454124731;
genesis.nNonce = 2402015;
hashGenesisBlock = genesis.GetHash();

vFixedSeeds.clear();
vSeeds.clear();
vSeeds.push_back(CDNSSeedData("seed5.copico.io", "seed5.copico.io"));
vSeeds.push_back(CDNSSeedData("seed11.copico.io", "seed11.copico.io"));


base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 139); // Testnet cazcoin addresses start with 'x' or 'y'
Expand Down
69 changes: 67 additions & 2 deletions src/chainparamsseeds.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,74 @@
* IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.
*/
static SeedSpec6 pnSeed6_main[] = {
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x96,0xbf,0x17}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x96,0xbf,0x24}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6c,0x3d,0xd5,0x0e}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6c,0x3d,0xb9,0x22}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0xa1,0x1c}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x2c,0x71}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x20,0xad,0x11}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x6d,0xc9}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4d,0xd5,0x69}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x5c,0x71}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x0a,0x8c}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x5a,0xd8}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x0b,0x38}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x0e,0x8d}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4d,0x50,0x75}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x96,0xbf,0x17}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x96,0xbf,0x24}, 17350}
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x20,0xa9,0x81}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x28,0xa5}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x20,0xac,0x43}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x08,0x06,0xc1,0x42}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x8c,0x52,0x1f,0xa2}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4d,0x40,0xcc}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x50,0xf0,0x14,0xe0}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6c,0x3d,0xdc,0xa0}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x46,0x77}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4c,0xff,0x41}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x1b,0xe0}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x96,0xbf,0x17}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4d,0x05,0xe4}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x8c,0x52,0x00,0xfb}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6c,0x3d,0x84,0x5b}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x2d,0xea}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xcf,0x94,0x0b,0x1e}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x75,0xc7}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x77,0xa1}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x40,0x41}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x20,0xcc,0x8a}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xcf,0x94,0x03,0xea}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x3f,0x62,0xa0}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4c,0x8e,0xc0}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4d,0x3b,0xb9}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc7,0xf7,0x07,0x1a}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x50,0xf0,0x12,0x35}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x50,0xf0,0x12,0x3a}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4c,0x9f,0x44}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x20,0x68,0xc4}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xcf,0x94,0x46,0xf3}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x29,0xb0}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x21,0xdd}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x29,0x52}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6b,0xbf,0x2e,0xe8}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd9,0x45,0x00,0xcc}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd9,0x45,0x00,0xd9}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0xc3,0x94}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0xc6,0xe9}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0xc7,0x14}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0xad,0xf2}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6c,0x3d,0xd4,0x04}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0xad,0xfc}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd1,0xfa,0xf9,0xd9}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6c,0x3d,0xa6,0xab}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x8c,0x52,0x3a,0x06}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd9,0x45,0x01,0x83}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd9,0x45,0x02,0xf2}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd9,0x45,0x02,0xfc}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4c,0x80,0xa1}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4c,0x83,0x2b}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x68,0xee,0xb9,0xfe}, 17350},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x76,0x6f}, 17350}
};

static SeedSpec6 pnSeed6_test[] = {
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

//! These need to be macros, as clientversion.cpp's and cazcoin*-res.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 1
#define CLIENT_VERSION_MINOR 1
#define CLIENT_VERSION_MINOR 2
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0

Expand Down
2 changes: 1 addition & 1 deletion src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bool fTestNet = false; //Params().NetworkID() == CBaseChainParams::TESTNET;
// Modifier interval: time to elapse before new modifier is computed
// Set to 3-hour for production network and 20-minute for test network
unsigned int nModifierInterval;
int nStakeTargetSpacing = 60;
int nStakeTargetSpacing = 90;
unsigned int getIntervalVersion(bool fTestNet)
{
if (fTestNet)
Expand Down
42 changes: 32 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ bool fCheckBlockIndex = false;
unsigned int nCoinCacheSize = 5000;
bool fAlerts = DEFAULT_ALERTS;

unsigned int nStakeMinAge = 60;
unsigned int nStakeMinAge = 60 * 60;
int64_t nReserveBalance = 0;

/** Fees smaller than this (in duffs) are considered zero fee (for relaying and mining)
Expand Down Expand Up @@ -1006,7 +1006,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState& state)
}

if (tx.IsCoinBase()) {
if (/*tx.vin[0].scriptSig.size() < 2 || */ tx.vin[0].scriptSig.size() > 150)
if (tx.vin[0].scriptSig.size() < 2 || tx.vin[0].scriptSig.size() > 150)
return state.DoS(100, error("CheckTransaction() : coinbase script size=%d", tx.vin[0].scriptSig.size()),
REJECT_INVALID, "bad-cb-length");
} else {
Expand Down Expand Up @@ -1106,8 +1106,10 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState& state, const CTransa

// is it already in the memory pool?
uint256 hash = tx.GetHash();
if (pool.exists(hash))
if (pool.exists(hash)) {
LogPrintf("%s tx already in mempool\n", __func__);
return false;
}

// ----------- swiftTX transaction scanning -----------

Expand Down Expand Up @@ -1156,9 +1158,9 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState& state, const CTransa
if (pfMissingInputs)
*pfMissingInputs = true;
return false;
}
}
}

// are the actual inputs available?
if (!view.HaveInputs(tx))
return state.Invalid(error("AcceptToMemoryPool : inputs already spent"),
Expand Down Expand Up @@ -1620,10 +1622,18 @@ int64_t GetBlockValue(int nHeight)
nSubsidy = 30000000 * COIN;
} else if (nHeight > 0 && nHeight < 100) {
nSubsidy = 0 * COIN;
} else if (nHeight >= 100 && nHeight < 345600) {
} else if (nHeight >= 100 && nHeight < 118900) {
nSubsidy = 40 * COIN;
} else if (nHeight >= 345600 && nHeight < 1036800) {
} else if (nHeight >= 118900 && nHeight < 132000) {
nSubsidy = 50 * COIN;
} else if (nHeight >= 132000 && nHeight < 172800) {
nSubsidy = 30 * COIN;
} else if (nHeight >= 172800 && nHeight < 259200) {
nSubsidy = 25 * COIN;
} else if (nHeight >= 259200 && nHeight < 345600) {
nSubsidy = 20 * COIN;
} else if (nHeight >= 345600 && nHeight < 1036800) {
nSubsidy = 15 * COIN;
} else if (nHeight >= 1036800 && nHeight < 1728000) {
nSubsidy = 10 * COIN;
} else if (nHeight >= 1728000) {
Expand Down Expand Up @@ -1919,6 +1929,8 @@ bool CheckInputs(const CTransaction& tx, CValidationState& state, const CCoinsVi

bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean)
{
if (pindex->GetBlockHash() != view.GetBestBlock())
LogPrintf("%s : pindex=%s view=%s\n", __func__, pindex->GetBlockHash().GetHex(), view.GetBestBlock().GetHex());
assert(pindex->GetBlockHash() == view.GetBestBlock());

if (pfClean)
Expand Down Expand Up @@ -1964,7 +1976,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
}

// restore inputs
if (i > 0) { // not coinbases
if (!tx.IsCoinBase()) { // not coinbases
const CTxUndo& txundo = blockUndo.vtxundo[i - 1];
if (txundo.vprevout.size() != tx.vin.size())
return error("DisconnectBlock() : transaction and undo data inconsistent - txundo.vprevout.siz=%d tx.vin.siz=%d", txundo.vprevout.size(), tx.vin.size());
Expand Down Expand Up @@ -4614,6 +4626,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,

else if (pfrom->nVersion == 0) {
// Must have a version message before anything else
LOCK(cs_main);
Misbehaving(pfrom->GetId(), 1);
return false;
}
Expand All @@ -4638,6 +4651,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
if (pfrom->nVersion < CADDR_TIME_VERSION && addrman.size() > 1000)
return true;
if (vAddr.size() > 1000) {
LOCK(cs_main);
Misbehaving(pfrom->GetId(), 20);
return error("message addr size() = %u", vAddr.size());
}
Expand Down Expand Up @@ -4696,6 +4710,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
vector<CInv> vInv;
vRecv >> vInv;
if (vInv.size() > MAX_INV_SZ) {
LOCK(cs_main);
Misbehaving(pfrom->GetId(), 20);
return error("message inv size() = %u", vInv.size());
}
Expand Down Expand Up @@ -4744,6 +4759,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
vector<CInv> vInv;
vRecv >> vInv;
if (vInv.size() > MAX_INV_SZ) {
LOCK(cs_main);
Misbehaving(pfrom->GetId(), 20);
return error("message getdata size() = %u", vInv.size());
}
Expand Down Expand Up @@ -4986,6 +5002,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// Bypass the normal CBlock deserialization, as we don't want to risk deserializing 2000 full blocks.
unsigned int nCount = ReadCompactSize(vRecv);
if (nCount > MAX_HEADERS_RESULTS) {
LOCK(cs_main);
Misbehaving(pfrom->GetId(), 20);
return error("headers message size = %u", nCount);
}
Expand Down Expand Up @@ -5209,6 +5226,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// This isn't a Misbehaving(100) (immediate ban) because the
// peer might be an older or different implementation with
// a different signature key, etc.
LOCK(cs_main);
Misbehaving(pfrom->GetId(), 10);
}
}
Expand All @@ -5219,17 +5237,19 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
strCommand == "filteradd" ||
strCommand == "filterclear")) {
LogPrintf("bloom message=%s\n", strCommand);
LOCK(cs_main);
Misbehaving(pfrom->GetId(), 100);
}

else if (strCommand == "filterload") {
CBloomFilter filter;
vRecv >> filter;

if (!filter.IsWithinSizeConstraints())
if (!filter.IsWithinSizeConstraints()) {
// There is no excuse for sending a too-large filter
LOCK(cs_main);
Misbehaving(pfrom->GetId(), 100);
else {
} else {
LOCK(pfrom->cs_filter);
delete pfrom->pfilter;
pfrom->pfilter = new CBloomFilter(filter);
Expand All @@ -5246,12 +5266,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// Nodes must NEVER send a data item > 520 bytes (the max size for a script data object,
// and thus, the maximum size any matched object can have) in a filteradd message
if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE) {
LOCK(cs_main);
Misbehaving(pfrom->GetId(), 100);
} else {
LOCK(pfrom->cs_filter);
if (pfrom->pfilter)
pfrom->pfilter->insert(vData);
else
LOCK(cs_main);
Misbehaving(pfrom->GetId(), 100);
}
}
Expand Down
Loading

0 comments on commit a9b8b50

Please sign in to comment.