Skip to content

Commit fd42ad2

Browse files
committed
Add p2pool-style BLOCK FOUND banners for all block detection paths
Four distinct framed banners in LOG_WARNING: 1. PARENT NETWORK BLOCK FOUND — locally mined share meets LTC block target 2. TWIN BLOCK FOUND — same PoW meets BOTH parent and merged targets 3. MERGED BLOCK FOUND — aux chain (DOGE etc) target met 4. BLOCK FOUND (detected from share) — peer share meets block target
1 parent c30b3a4 commit fd42ad2

3 files changed

Lines changed: 45 additions & 19 deletions

File tree

src/c2pool/merged/merged_mining.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -744,13 +744,17 @@ void MergedMiningManager::try_submit_merged_blocks(
744744
continue; // doesn't meet this chain's target
745745
}
746746

747-
LOG_INFO << "\n"
748-
<< " ### MERGED BLOCK FOUND! " << chain.config.symbol << " ###\n"
749-
<< " Chain: " << chain.config.symbol << " (chain_id=" << chain.config.chain_id << ")\n"
750-
<< " Height: " << chain.current_work.height << "\n"
751-
<< " Aux hash: " << chain.current_work.block_hash.GetHex() << "\n"
752-
<< " Aux target: " << chain.current_work.target.GetHex() << "\n"
753-
<< " Parent PoW: " << parent_hash.GetHex();
747+
LOG_WARNING << "\n"
748+
<< "######################################################################\n"
749+
<< "### MERGED BLOCK FOUND! " << chain.config.symbol
750+
<< std::string(std::max(0, 39 - (int)chain.config.symbol.size()), ' ') << "###\n"
751+
<< "######################################################################\n"
752+
<< " Chain: " << chain.config.symbol << " (chain_id=" << chain.config.chain_id << ")\n"
753+
<< " Height: " << chain.current_work.height << "\n"
754+
<< " Block hash: " << chain.current_work.block_hash.GetHex() << "\n"
755+
<< " Aux target: " << chain.current_work.target.GetHex() << "\n"
756+
<< " Parent PoW: " << parent_hash.GetHex() << "\n"
757+
<< "######################################################################";
754758

755759
// Build aux merkle proof for this chain's slot
756760
auto proof = m_tree.compute_root(slot_hashes, slot);

src/core/web_server.cpp

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4258,7 +4258,16 @@ nlohmann::json MiningInterface::mining_submit(const std::string& username, const
42584258
static uint256 s_last_submitted_prev;
42594259
if (prev_block != s_last_submitted_prev) {
42604260
s_last_submitted_prev = prev_block;
4261-
LOG_INFO << "[LTC] Block meets blockchain target! Submitting to coin daemon";
4261+
uint256 block_hash = Hash(std::span<const unsigned char>(block_bytes.data(), block_bytes.size()));
4262+
LOG_WARNING << "\n"
4263+
<< "######################################################################\n"
4264+
<< "### PARENT NETWORK BLOCK FOUND! ###\n"
4265+
<< "######################################################################\n"
4266+
<< " Miner: " << username << "\n"
4267+
<< " Block hash: " << block_hash.GetHex() << "\n"
4268+
<< " PoW hash: " << pow_hash.GetHex() << "\n"
4269+
<< " Target: " << block_target.GetHex() << "\n"
4270+
<< "######################################################################";
42624271
submitblock(block_hex);
42634272
}
42644273
}
@@ -4527,14 +4536,6 @@ nlohmann::json MiningInterface::mining_submit(const std::string& username, const
45274536
}
45284537

45294538
if (!block_target.IsNull() && pow_hash <= block_target) {
4530-
// Twin block: same PoW hash meets BOTH parent and merged targets!
4531-
if (merged_found) {
4532-
LOG_INFO << "\n"
4533-
<< " *** TWIN BLOCK! ***\n"
4534-
<< " Parent + merged chain targets met by same PoW hash\n"
4535-
<< " PoW hash: " << pow_hash.GetHex();
4536-
}
4537-
45384539
uint256 header_merkle;
45394540
std::memcpy(header_merkle.data(), block_bytes.data() + 36, 32);
45404541

@@ -4559,7 +4560,28 @@ nlohmann::json MiningInterface::mining_submit(const std::string& username, const
45594560
static uint256 s_last_pool_submitted_prev;
45604561
if (prev_block != s_last_pool_submitted_prev) {
45614562
s_last_pool_submitted_prev = prev_block;
4562-
LOG_INFO << "[LTC] Pool block merkle_root validated, submitting to coin daemon";
4563+
uint256 block_hash = Hash(std::span<const unsigned char>(block_bytes.data(), block_bytes.size()));
4564+
if (merged_found) {
4565+
LOG_WARNING << "\n"
4566+
<< "######################################################################\n"
4567+
<< "### TWIN BLOCK FOUND! Parent + Merged in same PoW! ###\n"
4568+
<< "######################################################################\n"
4569+
<< " Miner: " << username << "\n"
4570+
<< " Block hash: " << block_hash.GetHex() << "\n"
4571+
<< " PoW hash: " << pow_hash.GetHex() << "\n"
4572+
<< " Target: " << block_target.GetHex() << "\n"
4573+
<< "######################################################################";
4574+
} else {
4575+
LOG_WARNING << "\n"
4576+
<< "######################################################################\n"
4577+
<< "### PARENT NETWORK BLOCK FOUND! ###\n"
4578+
<< "######################################################################\n"
4579+
<< " Miner: " << username << "\n"
4580+
<< " Block hash: " << block_hash.GetHex() << "\n"
4581+
<< " PoW hash: " << pow_hash.GetHex() << "\n"
4582+
<< " Target: " << block_target.GetHex() << "\n"
4583+
<< "######################################################################";
4584+
}
45634585
submitblock(block_hex);
45644586
}
45654587
}

src/impl/ltc/share_check.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,12 +638,12 @@ uint256 share_init_verify(const ShareT& share, bool check_pow = true)
638638
if (!block_target.IsNull() && pow_hash <= block_target) {
639639
LOG_WARNING << "\n"
640640
<< "######################################################################\n"
641-
<< "### BLOCK FOUND by pool! ###\n"
641+
<< "### BLOCK FOUND! (detected from share) ###\n"
642642
<< "######################################################################\n"
643643
<< " Share hash: " << share_hash.GetHex() << "\n"
644644
<< " PoW hash: " << pow_hash.GetHex() << "\n"
645645
<< " Block target:" << block_target.GetHex() << "\n"
646-
<< " Block bits: " << std::hex << share.m_min_header.m_bits << std::dec << "\n"
646+
<< " Absheight: " << share.m_absheight << "\n"
647647
<< "######################################################################";
648648
}
649649
}

0 commit comments

Comments
 (0)