diff --git a/src/Makefile.test.include b/src/Makefile.test.include index dc67aff528..10477fb3f9 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -123,6 +123,7 @@ BITCOIN_TESTS =\ test/pmt_tests.cpp \ test/policyestimator_tests.cpp \ test/pow_tests.cpp \ + test/pos_tests.cpp \ test/prevector_tests.cpp \ test/raii_event_tests.cpp \ test/random_tests.cpp \ diff --git a/src/consensus/tx_check.cpp b/src/consensus/tx_check.cpp index 32f5505276..d791206d9f 100644 --- a/src/consensus/tx_check.cpp +++ b/src/consensus/tx_check.cpp @@ -7,6 +7,8 @@ #include #include +extern bool fIsFakeNet; + bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fCheckDuplicateInputs) { // Basic checks that don't depend on any context @@ -43,7 +45,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fChe if (tx.IsCoinBase()) { - if (tx.vin[0].scriptSig.size() < 2) // || tx.vin[0].scriptSig.size() > 100 // TODO: (ss) ! + if (tx.vin[0].scriptSig.size() < 2 || (fIsFakeNet && tx.vin[0].scriptSig.size() > 100)) return state.Invalid(ValidationInvalidReason::CONSENSUS, false, REJECT_INVALID, "bad-cb-length"); } else diff --git a/src/miner.cpp b/src/miner.cpp index ba61818528..9c760cd37a 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -155,7 +155,7 @@ std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& sc bool baseScript = true; - if (pmasternodesview->GetCriminals().size() != 0) { + if (!fIsFakeNet && pmasternodesview->GetCriminals().size() != 0) { CMasternodesView::CMnCriminals criminals = pmasternodesview->GetCriminals(); CMasternodesView::CMnCriminals::iterator itCriminalMN = criminals.begin(); std::pair criminal = itCriminalMN->second; diff --git a/src/test/double_sign.cpp b/src/test/double_sign.cpp index ac673e26f2..a681a16edb 100644 --- a/src/test/double_sign.cpp +++ b/src/test/double_sign.cpp @@ -39,8 +39,6 @@ std::shared_ptr FinalizeBlock(std::shared_ptr pblock, const uint pblock->stakeModifier = pos::ComputeStakeModifier(prevStakeModifier, minterKey.GetPubKey().GetID()); - GenerateCoinbaseCommitment(*pblock, LookupBlockIndex(pblock->hashPrevBlock), Params().GetConsensus()); - pblock->hashMerkleRoot = BlockMerkleRoot(*pblock); do { diff --git a/src/test/pos_tests.cpp b/src/test/pos_tests.cpp new file mode 100644 index 0000000000..11c04724b9 --- /dev/null +++ b/src/test/pos_tests.cpp @@ -0,0 +1,211 @@ +#include +#include +#include +#include +#include +#include +#include +#include