11// Copyright (c) 2009-2010 Satoshi Nakamoto
2- // Copyright (c) 2009-2017 The Bitcoin Core developers
3- // Copyright (c) 2015-2017 The Dash developers
2+ // Copyright (c) 2009-2017 The Bitcoin Core developers
3+ // Copyright (c) 2015-2017 The Dash developers
44// Copyright (c) 2015-2017 The Bitsend developers
55// Distributed under the MIT software license, see the accompanying
66// file COPYING or http://www.opensource.org/licenses/mit-license.php.
6262/* *
6363 * Global state
6464 */
65-
65+
6666#define START_MASTERNODE_PAYMENTS 1430465291
6767
6868CCriticalSection cs_main;
@@ -1075,21 +1075,21 @@ bool AcceptableInputs(CTxMemPool& pool, CValidationState &state, const CTransact
10751075{
10761076 const CTransaction& tx = *ptx;
10771077 const uint256 hash = tx.GetHash ();
1078-
1078+
10791079 std::vector<uint256> vHashTxnToUncache;
10801080 AssertLockHeld (cs_main);
1081-
1081+
10821082 if (!CheckTransaction (tx, state))
10831083 return false ; // state filled in by CheckTransaction
10841084
10851085 // Coinbase is only valid in a block, not as a loose transaction
10861086 if (tx.IsCoinBase ())
10871087 return state.DoS (100 , false , REJECT_INVALID, " coinbase" );
1088-
1088+
10891089 // is it already in the memory pool?
10901090 if (pool.exists (hash))
10911091 return state.Invalid (false , REJECT_ALREADY_KNOWN, " txn-already-in-mempool" );
1092-
1092+
10931093 // Check for conflicts with in-memory transactions
10941094 std::set<uint256> setConflicts;
10951095 {
@@ -1134,7 +1134,7 @@ bool AcceptableInputs(CTxMemPool& pool, CValidationState &state, const CTransact
11341134 }
11351135 }
11361136 }
1137-
1137+
11381138 {
11391139 CCoinsView dummy;
11401140 CCoinsViewCache view (&dummy);
@@ -1161,7 +1161,7 @@ bool AcceptableInputs(CTxMemPool& pool, CValidationState &state, const CTransact
11611161 if (!pcoinsTip->HaveCoinsInCache (txin.prevout .hash ))
11621162 vHashTxnToUncache.push_back (txin.prevout .hash );
11631163 if (!view.HaveCoins (txin.prevout .hash )) {
1164- return false ;
1164+ return false ;
11651165 }
11661166 }
11671167
@@ -1178,17 +1178,17 @@ bool AcceptableInputs(CTxMemPool& pool, CValidationState &state, const CTransact
11781178 view.SetBackend (dummy);
11791179
11801180 }
1181-
1181+
11821182 // Check against previous transactions
11831183 // This is done last to help prevent CPU exhaustion denial-of-service attacks.
11841184 PrecomputedTransactionData txdata (tx);
11851185 if (!CheckInputs (tx, state, view, false , SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC, true , txdata)) {
1186-
1186+
11871187 LogPrintf (" CheckInputs is still false\n " );
11881188 return false ; // state filled in by CheckInputs
11891189 }
11901190 }
1191-
1191+
11921192 return true ;
11931193}
11941194
@@ -1346,14 +1346,14 @@ CAmount GetBlockSubsidy(int nBits, int nHeight, const Consensus::Params& consens
13461346 // TODO--
13471347
13481348 CAmount nSubsidy = 50 * COIN;
1349-
1349+
13501350 if (nHeight <= 2 )
1351- nSubsidy = 1306400 * COIN;
1352-
1351+ nSubsidy = 1306400 * COIN;
1352+
13531353 if (nHeight > (FORKX17_Main_Net-1000 ))nSubsidy = 25 * COIN;
13541354 if (nHeight >= ((FORKX17_Main_Net*33 )-50256 ))nSubsidy = 1 /10 * COIN;
1355-
1356-
1355+
1356+
13571357 return nSubsidy;
13581358}
13591359
@@ -1362,55 +1362,55 @@ CAmount GetMasternodePayment(int nHeight, CAmount blockValue)
13621362{
13631363 CAmount ret = blockValue/5 ; // start at 20%
13641364
1365-
13661365
1367- if (nHeight > 140500 ) ret += blockValue / 20 ;
1368- // 140500
1369- if (nHeight > 140500 +((288 *14 )* 1 )) ret += blockValue / 20 ;
1370- // 144532
1366+
1367+ if (nHeight > 140500 ) ret += blockValue / 20 ;
1368+ // 140500
1369+ if (nHeight > 140500 +((288 *14 )* 1 )) ret += blockValue / 20 ;
1370+ // 144532
13711371 if (nHeight > 140500 +((288 *14 )* 2 )) ret += blockValue / 20 ;
1372- // 148564
1373- if (nHeight > 140500 +((288 *14 )* 3 )) ret += blockValue / 20 ;
1374- // 152596
1375- if (nHeight > 140500 +((288 *14 )* 4 )) ret += blockValue / 20 ;
1372+ // 148564
1373+ if (nHeight > 140500 +((288 *14 )* 3 )) ret += blockValue / 20 ;
1374+ // 152596
1375+ if (nHeight > 140500 +((288 *14 )* 4 )) ret += blockValue / 20 ;
13761376 // 156628
1377- if (nHeight > 140500 +((288 *14 )* 5 )) ret += blockValue / 20 ;
1377+ if (nHeight > 140500 +((288 *14 )* 5 )) ret += blockValue / 20 ;
13781378 // 160660
1379- if (nHeight > 140500 +((288 *30 )* 6 )) ret += blockValue / 20 ;
1379+ if (nHeight > 140500 +((288 *30 )* 6 )) ret += blockValue / 20 ;
13801380 // 192340
1381- if (nHeight > 140500 +((288 *30 )* 7 )) ret += blockValue / 20 ;
1381+ if (nHeight > 140500 +((288 *30 )* 7 )) ret += blockValue / 20 ;
13821382 // 200980
1383- if (nHeight > 140500 +((288 *30 )* 8 )) ret += blockValue / 20 ;
1383+ if (nHeight > 140500 +((288 *30 )* 8 )) ret += blockValue / 20 ;
13841384 // 218260
1385- if (nHeight > 140500 +((288 *30 )* 9 )) ret += blockValue / 20 ;
1385+ if (nHeight > 140500 +((288 *30 )* 9 )) ret += blockValue / 20 ;
13861386 // 226900
13871387 if (nHeight > 140500 +((288 *30 )* 10 )) ret += blockValue / 20 ;
13881388 // 235540
1389- if (nHeight > 140500 +((288 *30 )* 11 )) ret += blockValue / 20 ;
1389+ if (nHeight > 140500 +((288 *30 )* 11 )) ret += blockValue / 20 ;
13901390 // 244180
13911391 /* For later Stop by 20% /80%
1392- if(nHeight > 140500+((288*30)* 12)) ret += blockValue / 50;
1392+ if(nHeight > 140500+((288*30)* 12)) ret += blockValue / 50;
13931393 // 252820
1394- if(nHeight > 140500+((288*30)* 13)) ret += blockValue / 50;
1394+ if(nHeight > 140500+((288*30)* 13)) ret += blockValue / 50;
13951395 // 261460
1396- if(nHeight > 140500+((288*30)* 14)) ret += blockValue / 50;
1396+ if(nHeight > 140500+((288*30)* 14)) ret += blockValue / 50;
13971397 // 270100
1398- if(nHeight > 140500+((288*30)* 15)) ret += blockValue / 50;
1398+ if(nHeight > 140500+((288*30)* 15)) ret += blockValue / 50;
13991399 // 278740
1400- if(nHeight > 140500+((288*30)* 16)) ret += blockValue / 50;
1401- // 287380
1402- if(nHeight > 140500+((288*30)* 17)) ret += blockValue / 50;
1400+ if(nHeight > 140500+((288*30)* 16)) ret += blockValue / 50;
1401+ // 287380
1402+ if(nHeight > 140500+((288*30)* 17)) ret += blockValue / 50;
14031403 // 296020
1404- if(nHeight > 140500+((288*30)* 18)) ret += blockValue / 50;
1404+ if(nHeight > 140500+((288*30)* 18)) ret += blockValue / 50;
14051405 // 304660
1406- if(nHeight > 140500+((288*30)* 19)) ret += blockValue / 50;
1406+ if(nHeight > 140500+((288*30)* 19)) ret += blockValue / 50;
14071407 // 313300
1408- if(nHeight > 140500+((288*30)* 20)) ret += blockValue / 50;
1408+ if(nHeight > 140500+((288*30)* 20)) ret += blockValue / 50;
14091409 // 321940
1410- if(nHeight > 140500+((288*30)* 21)) ret += blockValue / 100;
1410+ if(nHeight > 140500+((288*30)* 21)) ret += blockValue / 100;
14111411 */
14121412 // LogPrintf("Zugriff main.cpp 1448 blockValue %u\n", blockValue);
1413-
1413+
14141414
14151415 return ret;
14161416}
@@ -3153,15 +3153,15 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
31533153 if (block.vtx [i]->IsCoinBase ())
31543154 return state.DoS (100 , false , REJECT_INVALID, " bad-cb-multiple" , false , " more than one coinbase" );
31553155
3156-
3156+
31573157 /* *TODO-- */
31583158
31593159
31603160 // ----------- masternode payments / budgets -----------
31613161
31623162 bool MasternodePayments = false ;
31633163
3164-
3164+
31653165 if (block.nTime > START_MASTERNODE_PAYMENTS) MasternodePayments = true ;
31663166
31673167 if (!IsSporkActive (SPORK_1_MASTERNODE_PAYMENTS_ENFORCEMENT)){
@@ -3207,7 +3207,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
32073207 foundPaymentAndPayee = true ;
32083208 }
32093209 }
3210-
3210+
32113211 CTxDestination address1;
32123212 ExtractDestination (payee, address1);
32133213 CBitsendAddress address2 (address1);
@@ -3230,13 +3230,13 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
32303230 } else {
32313231 LogPrintf (" CheckBlock() : skipping masternode payment checks\n " );
32323232 }
3233-
3233+
32343234
32353235 // -------------------------------------------
32363236
32373237 // Check transactions
32383238 for (const auto & tx : block.vtx )
3239- if (!CheckTransaction (*tx, state, false ))
3239+ if (!CheckTransaction (*tx, state, true ))
32403240 return state.Invalid (false , state.GetRejectCode (), state.GetRejectReason (),
32413241 strprintf (" Transaction check failed (tx hash %s) %s" , tx->GetHash ().ToString (), state.GetDebugMessage ()));
32423242
@@ -3359,7 +3359,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
33593359 if (block.nBits != GetNextWorkRequired (pindexPrev, &block, consensusParams)){
33603360 LogPrintf (" diff failed with nHeight = %d \n " , nHeight);
33613361 return state.DoS (100 , false , REJECT_INVALID, " bad-diffbits" , false , " incorrect proof of work" );
3362- }
3362+ }
33633363 }
33643364 // Check timestamp against prev
33653365 if (block.GetBlockTime () <= pindexPrev->GetMedianTimePast ())
@@ -3651,13 +3651,13 @@ bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<cons
36513651 // darkSendPool.NewBlock();//todo++ must add
36523652 if (masternodePayments.ProcessBlock (chainActive.Height ()+10 ))
36533653 LogPrintf (" masternodePayments.ProcessBlock run success\n " );
3654-
3654+
36553655 mnscan.DoMasternodePOSChecks ();
36563656 }
36573657 }// /todo++ must be added
36583658
36593659 LogPrintf (" %s : ACCEPTED\n " , __func__);
3660-
3660+
36613661 return true ;
36623662}
36633663
0 commit comments