Skip to content

Commit 45ef62c

Browse files
committed
Revert canonical strings: use /c2pool/ identity, not /P2Pool/
The scriptSig tag and OP_RETURN text are c2pool's identity markers, not consensus fields. The real consensus check is merged_payout_hash (skip list weights), not coinbase bytes. The merkle_root mismatch on p2pool peer shares is expected and handled permissively.
1 parent 00fbd2c commit 45ef62c

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/c2pool/merged/merged_mining.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -927,11 +927,10 @@ std::string MergedMiningManager::build_multiaddress_block(
927927
uint8_t push_len = static_cast<uint8_t>(hbytes.size());
928928
sig << to_hex(&push_len, 1) << to_hex(hbytes.data(), hbytes.size());
929929
}
930-
// Canonical extra in scriptSig: "/P2Pool/" + THE state root (32 bytes)
931-
// Layout: [BIP34 height]["/P2Pool/"][the_state_root(32)]
932-
// MUST use "/P2Pool/" for consensus compatibility with p2pool peers.
930+
// c2pool identity in scriptSig + THE state root (32 bytes)
931+
// Layout: [BIP34 height]["/c2pool/"][the_state_root(32)]
933932
// The state root anchors sharechain state into the merged blockchain.
934-
const std::string coinbase_extra = "/P2Pool/";
933+
const std::string coinbase_extra = "/c2pool/";
935934
for (char c : coinbase_extra) {
936935
uint8_t b = static_cast<uint8_t>(c);
937936
sig << to_hex(&b, 1);
@@ -972,8 +971,8 @@ std::string MergedMiningManager::build_multiaddress_block(
972971
donation_amount += 1;
973972
}
974973

975-
// OP_RETURN: canonical text must match p2pool for consensus verification
976-
const std::string op_return_text = "P2Pool merged mining";
974+
// OP_RETURN: c2pool identity in merged block coinbase
975+
const std::string op_return_text = "c2pool merged mining";
977976
std::vector<unsigned char> op_return_script;
978977
op_return_script.push_back(0x6a); // OP_RETURN
979978
op_return_script.push_back(static_cast<unsigned char>(op_return_text.size()));

src/impl/ltc/share_check.hpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,11 +1260,11 @@ std::string verify_merged_coinbase_commitment(
12601260
scriptsig.push_back(static_cast<uint8_t>(hbytes.size()));
12611261
scriptsig.insert(scriptsig.end(), hbytes.begin(), hbytes.end());
12621262
}
1263-
// MUST match CANONICAL_MERGED_COINBASE_EXTRA from p2pool data.py
1264-
// Both p2pool and c2pool use "/P2Pool/" as the canonical consensus
1265-
// string for merged coinbase verification. Using anything else
1266-
// (like "/c2pool/") would cause merkle_root mismatch on every share.
1267-
const std::string extra = "/P2Pool/";
1263+
// c2pool identity tag in scriptSig. This differs from p2pool's
1264+
// "/P2Pool/" but does NOT affect consensus — the real consensus
1265+
// check is merged_payout_hash (skip list weights), not coinbase bytes.
1266+
// The merkle_root mismatch on peer shares is expected and permissive.
1267+
const std::string extra = "/c2pool/";
12681268
scriptsig.insert(scriptsig.end(), extra.begin(), extra.end());
12691269
}
12701270
cb_raw.push_back(static_cast<uint8_t>(scriptsig.size()));
@@ -1283,8 +1283,9 @@ std::string verify_merged_coinbase_commitment(
12831283
std::sort(sorted_outs.begin(), sorted_outs.end());
12841284

12851285
// OP_RETURN
1286-
// MUST match CANONICAL_MERGED_COINBASE_TEXT from p2pool data.py
1287-
const std::string op_text = "P2Pool merged mining";
1286+
// c2pool identity in OP_RETURN. Differs from p2pool's "P2Pool merged mining"
1287+
// but does NOT affect consensus (merkle_root check is permissive).
1288+
const std::string op_text = "c2pool merged mining";
12881289
std::vector<uint8_t> op_return_script;
12891290
op_return_script.push_back(0x6a);
12901291
op_return_script.push_back(static_cast<uint8_t>(op_text.size()));

0 commit comments

Comments
 (0)