Skip to content

Commit 0e1cb72

Browse files
authored
Merge pull request #123 from frstrtr/btc/v36-flag2-segwit-ssot
btc(v36): segwit gate consumes PoolConfig SSOT (FLAG 2) + FLAG 4 comment refresh
2 parents d38506a + c40869d commit 0e1cb72

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

src/impl/btc/config_pool.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ class PoolConfig : protected core::Fileconfig
119119

120120
// V36+ COMBINED_DONATION_SCRIPT (P2SH: OP_HASH160 <hash160(redeem)> OP_EQUAL)
121121
// 1-of-2 multisig: forrestv + frstrtr/c2pool dev key.
122-
// LTC-specific (BTC stays at v35 per jtoomim — see plan v2 §3); kept
123-
// here as inert byte data so get_donation_script() compiles for both
124-
// BTC v35 (returns the P2PK above) and LTC v36 paths.
122+
// LTC P2SH donation target. BTC now runs v36-active shares, but its
123+
// donation leg intentionally stays the V35 P2PK above (forrestv
124+
// canonical BTC-mainnet donation); this COMBINED P2SH is LTC-only,
125+
// kept here as inert byte data so get_donation_script() compiles for
126+
// both the BTC (P2PK) and LTC v36 (P2SH) paths.
125127
// Address: MLhSmVQxMusLE3pjGFvp4unFckgjeD8LUA (LTC mainnet P2SH).
126128
static constexpr std::array<uint8_t, 23> COMBINED_DONATION_SCRIPT = {
127129
0xa9, // OP_HASH160

src/impl/btc/share_check.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ uint256 share_init_verify(const ShareT& share, bool check_pow = true)
485485

486486
constexpr int64_t ver = ShareT::version;
487487

488-
if constexpr (ver >= btc::SEGWIT_ACTIVATION_VERSION)
488+
if constexpr (ver >= btc::PoolConfig::SEGWIT_ACTIVATION_VERSION)
489489
{
490490
if constexpr (requires { share.m_segwit_data; })
491491
{
@@ -563,7 +563,7 @@ uint256 share_init_verify(const ShareT& share, bool check_pow = true)
563563
// segwit_data (optional)
564564
if constexpr (requires { share.m_segwit_data; })
565565
{
566-
if constexpr (ver >= btc::SEGWIT_ACTIVATION_VERSION)
566+
if constexpr (ver >= btc::PoolConfig::SEGWIT_ACTIVATION_VERSION)
567567
{
568568
// PossiblyNoneType: ALWAYS serialize (p2pool writes default when None)
569569
if (share.m_segwit_data.has_value()) {
@@ -671,7 +671,7 @@ uint256 share_init_verify(const ShareT& share, bool check_pow = true)
671671
// --- Merkle root ---
672672
// For segwit-activated shares, use segwit_data.txid_merkle_link; otherwise merkle_link
673673
uint256 merkle_root;
674-
if constexpr (ver >= btc::SEGWIT_ACTIVATION_VERSION)
674+
if constexpr (ver >= btc::PoolConfig::SEGWIT_ACTIVATION_VERSION)
675675
{
676676
if constexpr (requires { share.m_segwit_data; })
677677
{
@@ -1163,7 +1163,7 @@ uint256 generate_share_transaction(const ShareT& share, TrackerT& tracker, bool
11631163
size_t n_outs = payout_outputs.size() + 1 /* donation */ + 1 /* OP_RETURN commitment */;
11641164
// Segwit commitment output (if applicable)
11651165
bool has_segwit = false;
1166-
if constexpr (ver >= btc::SEGWIT_ACTIVATION_VERSION)
1166+
if constexpr (ver >= btc::PoolConfig::SEGWIT_ACTIVATION_VERSION)
11671167
{
11681168
if constexpr (requires { share.m_segwit_data; })
11691169
{
@@ -1282,7 +1282,7 @@ uint256 generate_share_transaction(const ShareT& share, TrackerT& tracker, bool
12821282

12831283
if constexpr (requires { share.m_segwit_data; })
12841284
{
1285-
if constexpr (ver >= btc::SEGWIT_ACTIVATION_VERSION)
1285+
if constexpr (ver >= btc::PoolConfig::SEGWIT_ACTIVATION_VERSION)
12861286
{
12871287
// PossiblyNoneType: ALWAYS serialize (p2pool writes default when None).
12881288
// Must match share_init_verify — both paths must produce identical ref_hash.
@@ -1973,7 +1973,7 @@ uint256 verify_share(const ShareT& share, TrackerT& tracker)
19731973

19741974
if constexpr (requires { share.m_segwit_data; })
19751975
{
1976-
if constexpr (ver >= btc::SEGWIT_ACTIVATION_VERSION)
1976+
if constexpr (ver >= btc::PoolConfig::SEGWIT_ACTIVATION_VERSION)
19771977
{
19781978
// PossiblyNoneType: ALWAYS serialize (p2pool writes default when None)
19791979
if (share.m_segwit_data.has_value()) {

src/impl/btc/share_types.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#include <core/uint256.hpp>
44
#include <core/pack_types.hpp>
55
#include <core/pack.hpp>
6+
#include "config_pool.hpp" // SSOT: PoolConfig::SEGWIT_ACTIVATION_VERSION
67

78
namespace btc
89
{
910

10-
const uint64_t SEGWIT_ACTIVATION_VERSION = 17;
1111

1212
constexpr bool is_segwit_activated(uint64_t version)
1313
{
14-
return version >= SEGWIT_ACTIVATION_VERSION;
14+
return version >= PoolConfig::SEGWIT_ACTIVATION_VERSION;
1515
}
1616

1717
enum StaleInfo

0 commit comments

Comments
 (0)