Skip to content

Commit 52ab4c1

Browse files
committed
Add p2pool-style labels to dashboard payouts (auto/donation/explicit)
Server-side: add "source" field to /current_merged_payouts entries with values "auto-convert", "donation", or "explicit" matching p2pool's label system. Client-side: render labels with p2pool styling: - "⚠ auto" (gold) for auto-converted addresses with tooltip - "donation" (gray) for pool donation outputs - "✓ explicit" (green) for explicit merged addresses - "pool dev fee" label on LTC donation entry
1 parent f3194ff commit 52ab4c1

2 files changed

Lines changed: 51 additions & 5 deletions

File tree

src/core/web_server.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4218,11 +4218,25 @@ nlohmann::json MiningInterface::rest_current_merged_payouts()
42184218
// TODO: testnet detection for DOGE address versions
42194219

42204220
for (auto& [script, amount] : merged_payouts) {
4221+
// Determine source label (p2pool: auto-convert, donation, explicit)
4222+
std::string source = "auto-convert"; // default for V35 (no explicit merged addrs)
4223+
// Donation: P2PK (ends with OP_CHECKSIG), P2SH matching donation script,
4224+
// or script matching the known donation_script from MiningInterface
4225+
bool is_donation = (script.size() > 33 && script.back() == 0xac); // P2PK
4226+
if (!is_donation && !m_donation_script.empty() && script == m_donation_script)
4227+
is_donation = true; // matches configured donation script
4228+
if (!is_donation && script.size() == 23 && script[0] == 0xa9) {
4229+
// Check if P2SH matches combined donation hash (8c6272621d89e8fa...)
4230+
if (script[2] == 0x8c && script[3] == 0x62 && script[4] == 0x72)
4231+
is_donation = true;
4232+
}
4233+
if (is_donation) source = "donation";
4234+
// TODO: detect "explicit" when V36 shares carry merged_addresses
4235+
42214236
// Convert merged script to proper DOGE address
42224237
std::string merged_addr = script_to_address(script, "", merged_p2pkh_ver, merged_p2sh_ver);
42234238
if (merged_addr.empty()) {
4224-
// P2PK (donation script) — hash the pubkey to get address
4225-
if (script.size() > 33 && script.back() == 0xac) {
4239+
if (source == "donation") {
42264240
merged_addr = "donation";
42274241
}
42284242
}
@@ -4257,7 +4271,8 @@ nlohmann::json MiningInterface::rest_current_merged_payouts()
42574271
entry["merged"].push_back({
42584272
{"symbol", ci.symbol},
42594273
{"address", merged_addr.empty() ? hash160_hex : merged_addr},
4260-
{"amount", amount / 1e8}
4274+
{"amount", amount / 1e8},
4275+
{"source", source}
42614276
});
42624277
attached = true;
42634278
break;
@@ -4272,7 +4287,8 @@ nlohmann::json MiningInterface::rest_current_merged_payouts()
42724287
result[key]["merged"].push_back({
42734288
{"symbol", ci.symbol},
42744289
{"address", key},
4275-
{"amount", amount / 1e8}
4290+
{"amount", amount / 1e8},
4291+
{"source", source}
42764292
});
42774293
}
42784294
}

web-static/dashboard.html

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3392,12 +3392,20 @@ <h2>🔍 Share Explorer</h2>
33923392

33933393
// Main row for parent chain
33943394
var mainRow = tbody.append('tr');
3395-
mainRow.append('td').append('a')
3395+
var addrTd = mainRow.append('td');
3396+
addrTd.append('a')
33963397
.attr('class', 'hash-link')
33973398
.attr('href', currency_info.address_explorer_url_prefix + addr)
33983399
.attr('target', '_blank')
33993400
.attr('title', addr)
34003401
.text(addr);
3402+
if (addr === 'donation') {
3403+
addrTd.append('span')
3404+
.style('color', '#888')
3405+
.style('font-size', '0.6rem')
3406+
.style('margin-left', '4px')
3407+
.text('pool dev fee');
3408+
}
34013409
mainRow.append('td')
34023410
.style('text-align', 'right')
34033411
.attr('class', 'amount')
@@ -3424,6 +3432,28 @@ <h2>🔍 Share Explorer</h2>
34243432
.attr('target', '_blank')
34253433
.attr('title', merged.address)
34263434
.text(merged.address);
3435+
// p2pool-style source labels
3436+
if (merged.source === 'auto-convert') {
3437+
addrCell.append('span')
3438+
.style('color', '#b08800')
3439+
.style('font-size', '0.6rem')
3440+
.style('margin-left', '4px')
3441+
.attr('title', 'Auto-converted from parent chain address (same pubkey hash). During V35\u2192V36 transition, all merged addresses are auto-converted since V35 shares cannot carry explicit merged addresses.')
3442+
.text('\u26A0 auto');
3443+
} else if (merged.source === 'donation') {
3444+
addrCell.append('span')
3445+
.style('color', '#888')
3446+
.style('font-size', '0.6rem')
3447+
.style('margin-left', '4px')
3448+
.text('donation');
3449+
} else if (merged.source === 'explicit') {
3450+
addrCell.append('span')
3451+
.style('color', '#28a745')
3452+
.style('font-size', '0.6rem')
3453+
.style('margin-left', '4px')
3454+
.attr('title', 'Explicit merged chain address provided by miner via stratum username')
3455+
.text('\u2713 explicit');
3456+
}
34273457

34283458
subRow.append('td')
34293459
.style('text-align', 'right')

0 commit comments

Comments
 (0)