Merge branch 'master' into merge-mining

merge-mining
SChernykh 2 weeks ago
commit c3add767be

@ -760,6 +760,11 @@ void P2PServer::Peer::normalize()
void P2PServer::broadcast(const PoolBlock& block, const PoolBlock* parent)
{
// Don't broadcast blocks when shutting down
if (m_finished.load()) {
return;
}
MinerData miner_data = m_pool->miner_data();
if (block.m_txinGenHeight + 2 < miner_data.height) {

@ -54,6 +54,12 @@ static constexpr uint64_t MAX_BLOCK_SIZE = 128 * 1024 - 5;
// 0.6 XMR
static constexpr uint64_t BASE_BLOCK_REWARD = 600000000000ULL;
// 1000 years at 1 TH/s. It should be enough for any normal use.
static constexpr difficulty_type MAX_CUMULATIVE_DIFFICULTY{ 13019633956666736640ULL, 1710ULL };
// 1000 years at 1 block/second. It should be enough for any normal use.
static constexpr uint64_t MAX_SIDECHAIN_HEIGHT = 31556952000ULL;
struct DifficultyData
{
FORCEINLINE DifficultyData(uint64_t t, const difficulty_type& d) : m_timestamp(t), m_cumulativeDifficulty(d) {}

@ -326,12 +326,20 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
READ_VARINT(m_sidechainHeight);
if (m_sidechainHeight > MAX_SIDECHAIN_HEIGHT) {
return __LINE__;
}
READ_VARINT(m_difficulty.lo);
READ_VARINT(m_difficulty.hi);
READ_VARINT(m_cumulativeDifficulty.lo);
READ_VARINT(m_cumulativeDifficulty.hi);
if (m_cumulativeDifficulty > MAX_CUMULATIVE_DIFFICULTY) {
return __LINE__;
}
uint8_t merkle_proof_size;
READ_BYTE(merkle_proof_size);

Loading…
Cancel
Save