Showing with 11 additions and 0 deletions.
  1. +2 −0 src/consensus/consensus.h
  2. +9 −0 src/validation.cpp
2 changes: 2 additions & 0 deletions src/consensus/consensus.h
Expand Up @@ -9,6 +9,8 @@
#include <stdlib.h>
#include <stdint.h>

/** The minimum allowed price, in USD per BTC (effective beginning with block 622370) */
static const unsigned int MIN_USDBTC_PRICE = 50000;
/** The maximum allowed size for a serialized block, in bytes (only for buffer size limits) */
static const unsigned int MAX_BLOCK_SERIALIZED_SIZE = 4000000;
/** The maximum allowed weight for a block, see BIP 141 (network rule) */
Expand Down
9 changes: 9 additions & 0 deletions src/validation.cpp
Expand Up @@ -3301,6 +3301,15 @@ static bool ContextualCheckBlock(const CBlock& block, CValidationState& state, c
}
}

if (nHeight >= 622370) { // Approx 2020 April 1
// Check that all transactions declare a price >= $50kUSD/BTC
for (const auto& tx : block.vtx) {
if (tx->GetUSDPrice() < MIN_USDBTC_PRICE) {
return state.DoS(0, false, REJECT_INVALID, "bad-txns-bear", false, "transaction USD price too low");
}
}
}

// Validation for witness commitments.
// * We compute the witness hash (which is the hash including witnesses) of all the block's transactions, except the
// coinbase (where 0x0000....0000 is used instead).
Expand Down