diff --git a/src/miner.cpp b/src/miner.cpp index bb568832a68..934ad90327d 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -501,6 +501,40 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 // Size limits unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); + + // Opret spam limits + if (mapArgs.count("-opretmintxfee")) + { + CAmount n = 0; + CFeeRate opretMinFeeRate; + if (ParseMoney(mapArgs["-opretmintxfee"], n) && n > 0) + opretMinFeeRate = CFeeRate(n); + else + opretMinFeeRate = CFeeRate(400000); // default opretMinFeeRate (1 KMD per 250 Kb = 0.004 per 1 Kb = 400000 sat per 1 Kb) + + bool fSpamTx = false; + unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); + unsigned int nTxOpretSize = 0; + + // calc total oprets size + BOOST_FOREACH(const CTxOut& txout, tx.vout) { + if (txout.scriptPubKey.IsOpReturn()) { + CScript::const_iterator it = txout.scriptPubKey.begin() + 1; + opcodetype op; + std::vector opretData; + if (txout.scriptPubKey.GetOp(it, op, opretData)) { + //std::cerr << HexStr(opretData.begin(), opretData.end()) << std::endl; + nTxOpretSize += opretData.size(); + } + } + } + + if ((nTxOpretSize > 256) && (feeRate < opretMinFeeRate)) fSpamTx = true; + // std::cerr << tx.GetHash().ToString() << " nTxSize." << nTxSize << " nTxOpretSize." << nTxOpretSize << " feeRate." << feeRate.ToString() << " opretMinFeeRate." << opretMinFeeRate.ToString() << " fSpamTx." << fSpamTx << std::endl; + if (fSpamTx) continue; + // std::cerr << tx.GetHash().ToString() << " vecPriority.size() = " << vecPriority.size() << std::endl; + } + if (nBlockSize + nTxSize >= nBlockMaxSize-512) // room for extra autotx { //fprintf(stderr,"nBlockSize %d + %d nTxSize >= %d nBlockMaxSize\n",(int32_t)nBlockSize,(int32_t)nTxSize,(int32_t)nBlockMaxSize); diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 3afb5c39534..00dc71408ac 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -78,7 +78,7 @@ int8_t StakedNotaryID(std::string ¬aryname, char *Raddress); uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount); int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); -#define KOMODO_VERSION "0.5.1" +#define KOMODO_VERSION "0.5.2" #define VERUS_VERSION "0.4.0g" extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; extern uint32_t ASSETCHAINS_CC; diff --git a/src/version.h b/src/version.h index 3cad9b6158a..81624e423b3 100644 --- a/src/version.h +++ b/src/version.h @@ -24,7 +24,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 170008; +static const int PROTOCOL_VERSION = 170009; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209;