@@ -2209,13 +2209,49 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd
2209
2209
LogPrint (" bench" , " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs]\n " , nInputs - 1 , 0.001 * (nTime4 - nTime2), nInputs <= 1 ? 0 : 0.001 * (nTime4 - nTime2) / (nInputs-1 ), nTimeVerify * 0.000001 );
2210
2210
2211
2211
2212
- // DASH : MODIFIED TO CHECK MASTERNODE PAYMENTS AND SUPERBLOCKS
2212
+ // DASH
2213
2213
2214
2214
// It's possible that we simply don't have enough data and this could fail
2215
2215
// (i.e. block itself could be a correct one and we need to store it),
2216
2216
// that's why this is in ConnectBlock. Could be the other way around however -
2217
2217
// the peer who sent us this block is missing some data and wasn't able
2218
2218
// to recognize that block is actually invalid.
2219
+
2220
+ // DASH : CHECK TRANSACTIONS FOR INSTANTSEND
2221
+
2222
+ if (sporkManager.IsSporkActive (SPORK_3_INSTANTSEND_BLOCK_FILTERING)) {
2223
+ // Require other nodes to comply, send them some data in case they are missing it.
2224
+ for (const auto & tx : block.vtx ) {
2225
+ // skip txes that have no inputs
2226
+ if (tx->vin .empty ()) continue ;
2227
+ // LOOK FOR TRANSACTION LOCK IN OUR MAP OF OUTPOINTS
2228
+ for (const auto & txin : tx->vin ) {
2229
+ uint256 hashLocked;
2230
+ if (instantsend.GetLockedOutPointTxHash (txin.prevout , hashLocked) && hashLocked != tx->GetHash ()) {
2231
+ // The node which relayed this should switch to correct chain.
2232
+ // TODO: relay instantsend data/proof.
2233
+ LOCK (cs_main);
2234
+ mapRejectedBlocks.insert (std::make_pair (block.GetHash (), GetTime ()));
2235
+ return state.DoS (10 , error (" ConnectBlock(DASH): transaction %s conflicts with transaction lock %s" , tx->GetHash ().ToString (), hashLocked.ToString ()),
2236
+ REJECT_INVALID, " conflict-tx-lock" );
2237
+ }
2238
+ }
2239
+ uint256 txConflict;
2240
+ if (llmq::quorumInstantSendManager->GetConflictingTx (*tx, txConflict)) {
2241
+ // The node which relayed this should switch to correct chain.
2242
+ // TODO: relay instantsend data/proof.
2243
+ LOCK (cs_main);
2244
+ mapRejectedBlocks.insert (std::make_pair (block.GetHash (), GetTime ()));
2245
+ return state.DoS (10 , error (" ConnectBlock(DASH): transaction %s conflicts with transaction lock %s" , tx->GetHash ().ToString (), txConflict.ToString ()),
2246
+ REJECT_INVALID, " conflict-tx-lock" );
2247
+ }
2248
+ }
2249
+ } else {
2250
+ LogPrintf (" ConnectBlock(DASH): spork is off, skipping transaction locking checks\n " );
2251
+ }
2252
+
2253
+ // DASH : MODIFIED TO CHECK MASTERNODE PAYMENTS AND SUPERBLOCKS
2254
+
2219
2255
// TODO: resync data (both ways?) and try to reprocess this block later.
2220
2256
CAmount blockReward = nFees + GetBlockSubsidy (pindex->pprev ->nBits , pindex->pprev ->nHeight , chainparams.GetConsensus ());
2221
2257
std::string strError = " " ;
@@ -3269,44 +3305,6 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
3269
3305
if (block.vtx [i]->IsCoinBase ())
3270
3306
return state.DoS (100 , false , REJECT_INVALID, " bad-cb-multiple" , false , " more than one coinbase" );
3271
3307
3272
-
3273
- // DASH : CHECK TRANSACTIONS FOR INSTANTSEND
3274
-
3275
- if (sporkManager.IsSporkActive (SPORK_3_INSTANTSEND_BLOCK_FILTERING)) {
3276
- // We should never accept block which conflicts with completed transaction lock,
3277
- // that's why this is in CheckBlock unlike coinbase payee/amount.
3278
- // Require other nodes to comply, send them some data in case they are missing it.
3279
- for (const auto & tx : block.vtx ) {
3280
- // skip coinbase, it has no inputs
3281
- if (tx->IsCoinBase ()) continue ;
3282
- // LOOK FOR TRANSACTION LOCK IN OUR MAP OF OUTPOINTS
3283
- for (const auto & txin : tx->vin ) {
3284
- uint256 hashLocked;
3285
- if (instantsend.GetLockedOutPointTxHash (txin.prevout , hashLocked) && hashLocked != tx->GetHash ()) {
3286
- // The node which relayed this will have to switch later,
3287
- // relaying instantsend data won't help it.
3288
- LOCK (cs_main);
3289
- mapRejectedBlocks.insert (std::make_pair (block.GetHash (), GetTime ()));
3290
- return state.DoS (100 , false , REJECT_INVALID, " conflict-tx-lock" , false ,
3291
- strprintf (" transaction %s conflicts with transaction lock %s" , tx->GetHash ().ToString (), hashLocked.ToString ()));
3292
- }
3293
- }
3294
- uint256 txConflict;
3295
- if (llmq::quorumInstantSendManager->GetConflictingTx (*tx, txConflict)) {
3296
- // The node which relayed this will have to switch later,
3297
- // relaying instantsend data won't help it.
3298
- LOCK (cs_main);
3299
- mapRejectedBlocks.insert (std::make_pair (block.GetHash (), GetTime ()));
3300
- return state.DoS (100 , false , REJECT_INVALID, " conflict-tx-lock" , false ,
3301
- strprintf (" transaction %s conflicts with transaction lock %s" , tx->GetHash ().ToString (), txConflict.ToString ()));
3302
- }
3303
- }
3304
- } else {
3305
- LogPrintf (" CheckBlock(DASH): spork is off, skipping transaction locking checks\n " );
3306
- }
3307
-
3308
- // END DASH
3309
-
3310
3308
// Check transactions
3311
3309
for (const auto & tx : block.vtx )
3312
3310
if (!CheckTransaction (*tx, state))
0 commit comments