mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 11:29:23 +00:00
Removed hardfork code
Some checks are pending
C/C++ CI / build-ubuntu (map[c:gcc-11 cpp:g++-11 flags: os:ubuntu-20.04]) (push) Waiting to run
C/C++ CI / build-ubuntu (map[c:gcc-12 cpp:g++-12 flags: os:ubuntu-22.04]) (push) Waiting to run
C/C++ CI / build-ubuntu (map[c:gcc-8 cpp:g++-8 flags: os:ubuntu-20.04]) (push) Waiting to run
C/C++ CI / build-openbsd (map[architecture:x86-64 host:ubuntu-latest name:openbsd version:7.4]) (push) Waiting to run
C/C++ CI / build-alpine-static (map[arch:aarch64 branch:latest-stable flags:-ffunction-sections -Wno-error=inline -mfix-cortex-a53-835769 -mfix-cortex-a53-843419]) (push) Waiting to run
C/C++ CI / build-alpine-static (map[arch:riscv64 branch:edge flags:-ffunction-sections -Wno-error=inline]) (push) Waiting to run
C/C++ CI / build-alpine-static (map[arch:x86_64 branch:latest-stable flags:-ffunction-sections -Wno-error=inline]) (push) Waiting to run
C/C++ CI / build-ubuntu-static-libs (map[flags:-fuse-linker-plugin -ffunction-sections -Wno-error=inline]) (push) Waiting to run
C/C++ CI / build-ubuntu-aarch64 (map[flags:-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-20.04]) (push) Waiting to run
C/C++ CI / build-ubuntu-aarch64 (map[flags:-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-22.04]) (push) Waiting to run
C/C++ CI / build-windows-msys2 (map[c:clang cxx:clang++ flags:-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled]) (push) Waiting to run
C/C++ CI / build-windows-msys2 (map[c:gcc cxx:g++ flags:-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:OFF upnp:OFF vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:ON upnp:OFF vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:ON tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:ON os:2019 rx:ON tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:ON os:2022 rx:ON tls:ON upnp:ON vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Waiting to run
C/C++ CI / build-macos (push) Waiting to run
C/C++ CI / build-macos-aarch64 (push) Waiting to run
Microsoft C++ Code Analysis / Analyze (push) Waiting to run
source-snapshot / source-snapshot (push) Waiting to run
C/C++ CI / build-freebsd (map[architecture:x86-64 host:ubuntu-latest name:freebsd version:13.3]) (push) Waiting to run
clang-tidy / clang-tidy (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
cppcheck / cppcheck-ubuntu (push) Waiting to run
cppcheck / cppcheck-windows (push) Waiting to run
Sync test / sync-test-ubuntu-asan (push) Waiting to run
Sync test / sync-test-macos (map[flags:-Og -ftrapv -target arm64-apple-macos-11 os:macos-14]) (push) Waiting to run
Sync test / sync-test-ubuntu-tsan (push) Waiting to run
Sync test / sync-test-ubuntu-msan (push) Waiting to run
Sync test / sync-test-ubuntu-ubsan (push) Waiting to run
Sync test / sync-test-macos (map[flags:-Og -ftrapv os:macos-13]) (push) Waiting to run
Sync test / sync-test-windows-debug-asan (push) Waiting to run
Sync test / sync-test-windows-leaks (push) Waiting to run
Some checks are pending
C/C++ CI / build-ubuntu (map[c:gcc-11 cpp:g++-11 flags: os:ubuntu-20.04]) (push) Waiting to run
C/C++ CI / build-ubuntu (map[c:gcc-12 cpp:g++-12 flags: os:ubuntu-22.04]) (push) Waiting to run
C/C++ CI / build-ubuntu (map[c:gcc-8 cpp:g++-8 flags: os:ubuntu-20.04]) (push) Waiting to run
C/C++ CI / build-openbsd (map[architecture:x86-64 host:ubuntu-latest name:openbsd version:7.4]) (push) Waiting to run
C/C++ CI / build-alpine-static (map[arch:aarch64 branch:latest-stable flags:-ffunction-sections -Wno-error=inline -mfix-cortex-a53-835769 -mfix-cortex-a53-843419]) (push) Waiting to run
C/C++ CI / build-alpine-static (map[arch:riscv64 branch:edge flags:-ffunction-sections -Wno-error=inline]) (push) Waiting to run
C/C++ CI / build-alpine-static (map[arch:x86_64 branch:latest-stable flags:-ffunction-sections -Wno-error=inline]) (push) Waiting to run
C/C++ CI / build-ubuntu-static-libs (map[flags:-fuse-linker-plugin -ffunction-sections -Wno-error=inline]) (push) Waiting to run
C/C++ CI / build-ubuntu-aarch64 (map[flags:-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-20.04]) (push) Waiting to run
C/C++ CI / build-ubuntu-aarch64 (map[flags:-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-22.04]) (push) Waiting to run
C/C++ CI / build-windows-msys2 (map[c:clang cxx:clang++ flags:-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled]) (push) Waiting to run
C/C++ CI / build-windows-msys2 (map[c:gcc cxx:g++ flags:-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:OFF upnp:OFF vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:ON upnp:OFF vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:OFF tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2019 rx:ON tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:ON os:2019 rx:ON tls:ON upnp:ON vs:Visual Studio 16 2019 vspath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise]) (push) Waiting to run
C/C++ CI / build-windows-msbuild (map[grpc:ON os:2022 rx:ON tls:ON upnp:ON vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Waiting to run
C/C++ CI / build-macos (push) Waiting to run
C/C++ CI / build-macos-aarch64 (push) Waiting to run
Microsoft C++ Code Analysis / Analyze (push) Waiting to run
source-snapshot / source-snapshot (push) Waiting to run
C/C++ CI / build-freebsd (map[architecture:x86-64 host:ubuntu-latest name:freebsd version:13.3]) (push) Waiting to run
clang-tidy / clang-tidy (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
cppcheck / cppcheck-ubuntu (push) Waiting to run
cppcheck / cppcheck-windows (push) Waiting to run
Sync test / sync-test-ubuntu-asan (push) Waiting to run
Sync test / sync-test-macos (map[flags:-Og -ftrapv -target arm64-apple-macos-11 os:macos-14]) (push) Waiting to run
Sync test / sync-test-ubuntu-tsan (push) Waiting to run
Sync test / sync-test-ubuntu-msan (push) Waiting to run
Sync test / sync-test-ubuntu-ubsan (push) Waiting to run
Sync test / sync-test-macos (map[flags:-Og -ftrapv os:macos-13]) (push) Waiting to run
Sync test / sync-test-windows-debug-asan (push) Waiting to run
Sync test / sync-test-windows-leaks (push) Waiting to run
This commit is contained in:
parent
c88f126cb1
commit
1053e22a52
5 changed files with 74 additions and 153 deletions
|
@ -324,15 +324,9 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||||
parallel_run(uv_default_loop_checked(), Precalc(m_shares, m_poolBlockTemplate->m_txkeySec));
|
parallel_run(uv_default_loop_checked(), Precalc(m_shares, m_poolBlockTemplate->m_txkeySec));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_poolBlockTemplate->merge_mining_enabled()) {
|
|
||||||
m_poolBlockTemplate->m_merkleTreeData = PoolBlock::encode_merkle_tree_data(static_cast<uint32_t>(data.aux_chains.size() + 1), data.aux_nonce);
|
m_poolBlockTemplate->m_merkleTreeData = PoolBlock::encode_merkle_tree_data(static_cast<uint32_t>(data.aux_chains.size() + 1), data.aux_nonce);
|
||||||
m_poolBlockTemplate->m_merkleTreeDataSize = 0;
|
m_poolBlockTemplate->m_merkleTreeDataSize = 0;
|
||||||
writeVarint(m_poolBlockTemplate->m_merkleTreeData, [this](uint8_t) { ++m_poolBlockTemplate->m_merkleTreeDataSize; });
|
writeVarint(m_poolBlockTemplate->m_merkleTreeData, [this](uint8_t) { ++m_poolBlockTemplate->m_merkleTreeDataSize; });
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_poolBlockTemplate->m_merkleTreeData = 0;
|
|
||||||
m_poolBlockTemplate->m_merkleTreeDataSize = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
select_mempool_transactions(mempool);
|
select_mempool_transactions(mempool);
|
||||||
|
|
||||||
|
@ -615,14 +609,8 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||||
m_poolBlockTemplate->m_sidechainId = {};
|
m_poolBlockTemplate->m_sidechainId = {};
|
||||||
m_poolBlockTemplate->m_merkleRoot = {};
|
m_poolBlockTemplate->m_merkleRoot = {};
|
||||||
|
|
||||||
if (m_poolBlockTemplate->merge_mining_enabled()) {
|
|
||||||
m_poolBlockTemplate->m_auxChains = data.aux_chains;
|
m_poolBlockTemplate->m_auxChains = data.aux_chains;
|
||||||
m_poolBlockTemplate->m_auxNonce = data.aux_nonce;
|
m_poolBlockTemplate->m_auxNonce = data.aux_nonce;
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_poolBlockTemplate->m_auxChains.clear();
|
|
||||||
m_poolBlockTemplate->m_auxNonce = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
init_merge_mining_merkle_proof();
|
init_merge_mining_merkle_proof();
|
||||||
|
|
||||||
|
@ -663,10 +651,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pool_block_debug()) {
|
if (pool_block_debug()) {
|
||||||
const size_t merkle_root_offset =
|
const size_t merkle_root_offset = m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize;
|
||||||
m_poolBlockTemplate->merge_mining_enabled()
|
|
||||||
? (m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize)
|
|
||||||
: (m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2);
|
|
||||||
|
|
||||||
memcpy(m_blockTemplateBlob.data() + merkle_root_offset, m_poolBlockTemplate->m_merkleRoot.h, HASH_SIZE);
|
memcpy(m_blockTemplateBlob.data() + merkle_root_offset, m_poolBlockTemplate->m_merkleRoot.h, HASH_SIZE);
|
||||||
memcpy(m_fullDataBlob.data() + merkle_root_offset, m_poolBlockTemplate->m_merkleRoot.h, HASH_SIZE);
|
memcpy(m_fullDataBlob.data() + merkle_root_offset, m_poolBlockTemplate->m_merkleRoot.h, HASH_SIZE);
|
||||||
|
@ -965,15 +950,9 @@ int BlockTemplate::create_miner_tx(const MinerData& data, const std::vector<Mine
|
||||||
|
|
||||||
m_minerTxExtra.push_back(TX_EXTRA_MERGE_MINING_TAG);
|
m_minerTxExtra.push_back(TX_EXTRA_MERGE_MINING_TAG);
|
||||||
|
|
||||||
if (!m_poolBlockTemplate->merge_mining_enabled()) {
|
|
||||||
m_minerTxExtra.push_back(HASH_SIZE);
|
|
||||||
m_minerTxExtra.insert(m_minerTxExtra.end(), HASH_SIZE, 0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_minerTxExtra.push_back(static_cast<uint8_t>(m_poolBlockTemplate->m_merkleTreeDataSize + HASH_SIZE));
|
m_minerTxExtra.push_back(static_cast<uint8_t>(m_poolBlockTemplate->m_merkleTreeDataSize + HASH_SIZE));
|
||||||
writeVarint(m_poolBlockTemplate->m_merkleTreeData, m_minerTxExtra);
|
writeVarint(m_poolBlockTemplate->m_merkleTreeData, m_minerTxExtra);
|
||||||
m_minerTxExtra.insert(m_minerTxExtra.end(), HASH_SIZE, 0);
|
m_minerTxExtra.insert(m_minerTxExtra.end(), HASH_SIZE, 0);
|
||||||
}
|
|
||||||
// TX_EXTRA end
|
// TX_EXTRA end
|
||||||
|
|
||||||
writeVarint(m_minerTxExtra.size(), m_minerTx);
|
writeVarint(m_minerTxExtra.size(), m_minerTx);
|
||||||
|
@ -1064,9 +1043,7 @@ hash BlockTemplate::calc_miner_tx_hash(uint32_t extra_nonce) const
|
||||||
merge_mining_root = get_root_from_proof(sidechain_id, m_poolBlockTemplate->m_merkleProof, aux_slot, n_aux_chains);
|
merge_mining_root = get_root_from_proof(sidechain_id, m_poolBlockTemplate->m_merkleProof, aux_slot, n_aux_chains);
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t merkle_root_offset = m_poolBlockTemplate->merge_mining_enabled()
|
const size_t merkle_root_offset = extra_nonce_offset + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize;
|
||||||
? (extra_nonce_offset + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize)
|
|
||||||
: (extra_nonce_offset + m_poolBlockTemplate->m_extraNonceSize + 2);
|
|
||||||
|
|
||||||
// 1. Prefix (everything except vin_rct_type byte in the end)
|
// 1. Prefix (everything except vin_rct_type byte in the end)
|
||||||
// Apply extra_nonce in-place because we can't write to the block template here
|
// Apply extra_nonce in-place because we can't write to the block template here
|
||||||
|
@ -1416,9 +1393,7 @@ std::vector<uint8_t> BlockTemplate::get_block_template_blob(uint32_t template_id
|
||||||
const uint32_t aux_slot = get_aux_slot(m_sidechain->consensus_hash(), m_poolBlockTemplate->m_auxNonce, n_aux_chains);
|
const uint32_t aux_slot = get_aux_slot(m_sidechain->consensus_hash(), m_poolBlockTemplate->m_auxNonce, n_aux_chains);
|
||||||
merge_mining_root = get_root_from_proof(sidechain_id, m_poolBlockTemplate->m_merkleProof, aux_slot, n_aux_chains);
|
merge_mining_root = get_root_from_proof(sidechain_id, m_poolBlockTemplate->m_merkleProof, aux_slot, n_aux_chains);
|
||||||
|
|
||||||
merkle_root_offset = m_poolBlockTemplate->merge_mining_enabled()
|
merkle_root_offset = m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize;
|
||||||
? (m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2 + m_poolBlockTemplate->m_merkleTreeDataSize)
|
|
||||||
: (m_extraNonceOffsetInTemplate + m_poolBlockTemplate->m_extraNonceSize + 2);
|
|
||||||
|
|
||||||
*pThis = this;
|
*pThis = this;
|
||||||
|
|
||||||
|
|
|
@ -805,10 +805,7 @@ void P2PServer::broadcast(const PoolBlock& block, const PoolBlock* parent)
|
||||||
writeVarint(total_reward, data->pruned_blob);
|
writeVarint(total_reward, data->pruned_blob);
|
||||||
writeVarint(outputs_blob_size, data->pruned_blob);
|
writeVarint(outputs_blob_size, data->pruned_blob);
|
||||||
|
|
||||||
if (block.merge_mining_enabled()) {
|
|
||||||
data->pruned_blob.insert(data->pruned_blob.end(), block.m_sidechainId.h, block.m_sidechainId.h + HASH_SIZE);
|
data->pruned_blob.insert(data->pruned_blob.end(), block.m_sidechainId.h, block.m_sidechainId.h + HASH_SIZE);
|
||||||
}
|
|
||||||
|
|
||||||
data->pruned_blob.insert(data->pruned_blob.end(), mainchain_data.begin() + outputs_offset + outputs_blob_size, mainchain_data.end());
|
data->pruned_blob.insert(data->pruned_blob.end(), mainchain_data.begin() + outputs_offset + outputs_blob_size, mainchain_data.end());
|
||||||
|
|
||||||
const size_t N = block.m_transactions.size();
|
const size_t N = block.m_transactions.size();
|
||||||
|
|
|
@ -204,17 +204,10 @@ std::vector<uint8_t> PoolBlock::serialize_mainchain_data(size_t* header_size, si
|
||||||
|
|
||||||
*(p++) = TX_EXTRA_MERGE_MINING_TAG;
|
*(p++) = TX_EXTRA_MERGE_MINING_TAG;
|
||||||
|
|
||||||
if (!merge_mining_enabled()) {
|
|
||||||
*(p++) = HASH_SIZE;
|
|
||||||
memcpy(p, m_sidechainId.h, HASH_SIZE);
|
|
||||||
p += HASH_SIZE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*(p++) = static_cast<uint8_t>(m_merkleTreeDataSize + HASH_SIZE);
|
*(p++) = static_cast<uint8_t>(m_merkleTreeDataSize + HASH_SIZE);
|
||||||
writeVarint(m_merkleTreeData, [&p](const uint8_t b) { *(p++) = b; });
|
writeVarint(m_merkleTreeData, [&p](const uint8_t b) { *(p++) = b; });
|
||||||
memcpy(p, m_merkleRoot.h, HASH_SIZE);
|
memcpy(p, m_merkleRoot.h, HASH_SIZE);
|
||||||
p += HASH_SIZE;
|
p += HASH_SIZE;
|
||||||
}
|
|
||||||
|
|
||||||
writeVarint(static_cast<size_t>(p - tx_extra), data);
|
writeVarint(static_cast<size_t>(p - tx_extra), data);
|
||||||
data.insert(data.end(), tx_extra, p);
|
data.insert(data.end(), tx_extra, p);
|
||||||
|
@ -267,7 +260,6 @@ std::vector<uint8_t> PoolBlock::serialize_sidechain_data() const
|
||||||
writeVarint(m_cumulativeDifficulty.lo, data);
|
writeVarint(m_cumulativeDifficulty.lo, data);
|
||||||
writeVarint(m_cumulativeDifficulty.hi, data);
|
writeVarint(m_cumulativeDifficulty.hi, data);
|
||||||
|
|
||||||
if (merge_mining_enabled()) {
|
|
||||||
const uint8_t n = static_cast<uint8_t>(m_merkleProof.size());
|
const uint8_t n = static_cast<uint8_t>(m_merkleProof.size());
|
||||||
data.push_back(n);
|
data.push_back(n);
|
||||||
|
|
||||||
|
@ -284,7 +276,6 @@ std::vector<uint8_t> PoolBlock::serialize_sidechain_data() const
|
||||||
writeVarint(mm_extra_data.second.size(), data);
|
writeVarint(mm_extra_data.second.size(), data);
|
||||||
data.insert(data.end(), mm_extra_data.second.begin(), mm_extra_data.second.end());
|
data.insert(data.end(), mm_extra_data.second.begin(), mm_extra_data.second.end());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const uint8_t* p = reinterpret_cast<const uint8_t*>(m_sidechainExtraBuf);
|
const uint8_t* p = reinterpret_cast<const uint8_t*>(m_sidechainExtraBuf);
|
||||||
data.insert(data.end(), p, p + sizeof(m_sidechainExtraBuf));
|
data.insert(data.end(), p, p + sizeof(m_sidechainExtraBuf));
|
||||||
|
@ -422,20 +413,4 @@ hash PoolBlock::calculate_tx_key_seed() const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PoolBlock::merge_mining_enabled() const
|
|
||||||
{
|
|
||||||
#ifdef P2POOL_UNIT_TESTS
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
switch (SideChain::network_type()) {
|
|
||||||
case NetworkType::Mainnet:
|
|
||||||
return m_timestamp >= MERGE_MINING_FORK_TIME;
|
|
||||||
case NetworkType::Testnet:
|
|
||||||
return m_timestamp >= MERGE_MINING_TESTNET_FORK_TIME;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace p2pool
|
} // namespace p2pool
|
||||||
|
|
|
@ -63,12 +63,6 @@ static constexpr uint64_t MAX_SIDECHAIN_HEIGHT = 31556952000ULL;
|
||||||
static constexpr uint64_t MERGE_MINING_MAX_CHAINS = 256;
|
static constexpr uint64_t MERGE_MINING_MAX_CHAINS = 256;
|
||||||
static constexpr uint64_t LOG2_MERGE_MINING_MAX_CHAINS = 8;
|
static constexpr uint64_t LOG2_MERGE_MINING_MAX_CHAINS = 8;
|
||||||
|
|
||||||
// Oct 12 2024 20:00:00 GMT+0000
|
|
||||||
static constexpr uint64_t MERGE_MINING_FORK_TIME = 1728763200;
|
|
||||||
|
|
||||||
// Aug 11 2024 20:00:00 GMT+0000
|
|
||||||
static constexpr uint64_t MERGE_MINING_TESTNET_FORK_TIME = 1723406400;
|
|
||||||
|
|
||||||
struct DifficultyData
|
struct DifficultyData
|
||||||
{
|
{
|
||||||
FORCEINLINE DifficultyData(uint64_t t, const difficulty_type& d) : m_timestamp(t), m_cumulativeDifficulty(d) {}
|
FORCEINLINE DifficultyData(uint64_t t, const difficulty_type& d) : m_timestamp(t), m_cumulativeDifficulty(d) {}
|
||||||
|
@ -217,8 +211,6 @@ struct PoolBlock
|
||||||
mm_n_aux_chains = 1U + ((k >> 3U) & ((1U << n) - 1U));
|
mm_n_aux_chains = 1U + ((k >> 3U) & ((1U << n) - 1U));
|
||||||
mm_nonce = static_cast<uint32_t>(m_merkleTreeData >> (3U + n));
|
mm_nonce = static_cast<uint32_t>(m_merkleTreeData >> (3U + n));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool merge_mining_enabled() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace p2pool
|
} // namespace p2pool
|
||||||
|
|
|
@ -70,7 +70,7 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
|
||||||
READ_VARINT(m_timestamp);
|
READ_VARINT(m_timestamp);
|
||||||
READ_BUF(m_prevId.h, HASH_SIZE);
|
READ_BUF(m_prevId.h, HASH_SIZE);
|
||||||
|
|
||||||
if (merge_mining_enabled() && (m_minorVersion > 127)) return __LINE__;
|
if (m_minorVersion > 127) return __LINE__;
|
||||||
|
|
||||||
const int nonce_offset = static_cast<int>(data - data_begin);
|
const int nonce_offset = static_cast<int>(data - data_begin);
|
||||||
READ_BUF(&m_nonce, NONCE_SIZE);
|
READ_BUF(&m_nonce, NONCE_SIZE);
|
||||||
|
@ -150,10 +150,8 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
|
||||||
outputs_blob_size = static_cast<int>(tmp);
|
outputs_blob_size = static_cast<int>(tmp);
|
||||||
|
|
||||||
// Required by sidechain.get_outputs_blob() to speed up repeated broadcasts from different peers
|
// Required by sidechain.get_outputs_blob() to speed up repeated broadcasts from different peers
|
||||||
if (merge_mining_enabled()) {
|
|
||||||
READ_BUF(m_sidechainId.h, HASH_SIZE);
|
READ_BUF(m_sidechainId.h, HASH_SIZE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Technically some p2pool node could keep stuffing block with transactions until reward is less than 0.6 XMR
|
// Technically some p2pool node could keep stuffing block with transactions until reward is less than 0.6 XMR
|
||||||
// But default transaction picking algorithm never does that. It's better to just ban such nodes
|
// But default transaction picking algorithm never does that. It's better to just ban such nodes
|
||||||
|
@ -193,19 +191,6 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
|
||||||
int mm_root_hash_offset;
|
int mm_root_hash_offset;
|
||||||
uint32_t mm_n_aux_chains, mm_nonce;
|
uint32_t mm_n_aux_chains, mm_nonce;
|
||||||
|
|
||||||
if (!merge_mining_enabled()) {
|
|
||||||
EXPECT_BYTE(HASH_SIZE);
|
|
||||||
|
|
||||||
mm_root_hash_offset = static_cast<int>((data - data_begin) + outputs_blob_size_diff);
|
|
||||||
READ_BUF(m_sidechainId.h, HASH_SIZE);
|
|
||||||
|
|
||||||
mm_n_aux_chains = 1;
|
|
||||||
mm_nonce = 0;
|
|
||||||
|
|
||||||
m_merkleRoot = static_cast<root_hash&>(m_sidechainId);
|
|
||||||
m_merkleTreeDataSize = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
uint64_t mm_field_size;
|
uint64_t mm_field_size;
|
||||||
READ_VARINT(mm_field_size);
|
READ_VARINT(mm_field_size);
|
||||||
|
|
||||||
|
@ -223,7 +208,6 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
|
||||||
if (static_cast<uint64_t>(data - mm_field_begin) != mm_field_size) {
|
if (static_cast<uint64_t>(data - mm_field_begin) != mm_field_size) {
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (static_cast<uint64_t>(data - tx_extra_begin) != tx_extra_size) return __LINE__;
|
if (static_cast<uint64_t>(data - tx_extra_begin) != tx_extra_size) return __LINE__;
|
||||||
|
|
||||||
|
@ -363,7 +347,6 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
|
||||||
m_merkleProof.clear();
|
m_merkleProof.clear();
|
||||||
m_mergeMiningExtra.clear();
|
m_mergeMiningExtra.clear();
|
||||||
|
|
||||||
if (merge_mining_enabled()) {
|
|
||||||
uint8_t merkle_proof_size;
|
uint8_t merkle_proof_size;
|
||||||
READ_BYTE(merkle_proof_size);
|
READ_BYTE(merkle_proof_size);
|
||||||
|
|
||||||
|
@ -410,7 +393,6 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
|
||||||
m_mergeMiningExtra.emplace_back(chain_id, std::move(t));
|
m_mergeMiningExtra.emplace_back(chain_id, std::move(t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
READ_BUF(m_sidechainExtraBuf, sizeof(m_sidechainExtraBuf));
|
READ_BUF(m_sidechainExtraBuf, sizeof(m_sidechainExtraBuf));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue