|
6 | 6 | #include <btclibs/util/strencodings.h> |
7 | 7 | #include <btclibs/crypto/sha256.h> |
8 | 8 | #include <core/uint256.hpp> |
| 9 | +#include <core/donation.hpp> |
9 | 10 |
|
10 | 11 | #include <array> |
11 | 12 | #include <cstdint> |
@@ -99,55 +100,15 @@ class PoolConfig : protected core::Fileconfig |
99 | 100 | // Must match frstrtr/p2pool-merged-v36 p2pool/data.py exactly. |
100 | 101 | // ----------------------------------------------------------------------- |
101 | 102 |
|
102 | | - // V35 DONATION_SCRIPT (P2PK: OP_PUSHBYTES_65 <uncompressed pubkey> OP_CHECKSIG). |
103 | | - // Same script bytes as forrestv/jtoomim BTC p2pool data.py:68 — the |
104 | | - // uncompressed pubkey is forrestv's; encoded address differs by network |
105 | | - // (1... on BTC mainnet, L... on LTC). Verified bit-identical 2026-04-28. |
106 | | - static constexpr std::array<uint8_t, 67> DONATION_SCRIPT = { |
107 | | - 0x41, // OP_PUSHBYTES_65 |
108 | | - 0x04, 0xff, 0xd0, 0x3d, 0xe4, 0x4a, 0x6e, 0x11, |
109 | | - 0xb9, 0x91, 0x7f, 0x3a, 0x29, 0xf9, 0x44, 0x32, |
110 | | - 0x83, 0xd9, 0x87, 0x1c, 0x9d, 0x74, 0x3e, 0xf3, |
111 | | - 0x0d, 0x5e, 0xdd, 0xcd, 0x37, 0x09, 0x4b, 0x64, |
112 | | - 0xd1, 0xb3, 0xd8, 0x09, 0x04, 0x96, 0xb5, 0x32, |
113 | | - 0x56, 0x78, 0x6b, 0xf5, 0xc8, 0x29, 0x32, 0xec, |
114 | | - 0x23, 0xc3, 0xb7, 0x4d, 0x9f, 0x05, 0xa6, 0xf9, |
115 | | - 0x5a, 0x8b, 0x55, 0x29, 0x35, 0x26, 0x56, 0x66, |
116 | | - 0x4b, |
117 | | - 0xac // OP_CHECKSIG |
118 | | - }; |
119 | | - |
120 | | - // V36+ COMBINED_DONATION_SCRIPT (P2SH: OP_HASH160 <hash160(redeem)> OP_EQUAL) |
121 | | - // 1-of-2 multisig redeem: forrestv + frstrtr/c2pool dev key. |
122 | | - // |
123 | | - // INTENTIONAL unified cross-coin v36 donation target. This is NOT inert and |
124 | | - // NOT LTC-only: BTC v36 coinbases deliberately pay this combined P2SH. The |
125 | | - // identical 20-byte hash160 (8c627262..8e85) is emitted by EVERY coin's v36 |
126 | | - // gentx (btc/ltc/bch/dgb) via PoolConfig::get_donation_script(>=36). Per-coin |
127 | | - // baseline conformance (vs each coin's own p2pool source) still governs every |
128 | | - // OTHER consensus aspect; the v36 donation target is the one deliberate |
129 | | - // cross-coin exception (operator FLAG6 ruling 2026-06-17, option-b). |
130 | | - // |
131 | | - // The hash160 renders as MLhSmVQxMusLE3pjGFvp4unFckgjeD8LUA under the LTC |
132 | | - // mainnet P2SH prefix; the same hash160 is the shared target on all coins |
133 | | - // (only the base58 rendering differs per coin prefix, the redeem does not). |
134 | | - static constexpr std::array<uint8_t, 23> COMBINED_DONATION_SCRIPT = { |
135 | | - 0xa9, // OP_HASH160 |
136 | | - 0x14, // PUSH 20 bytes |
137 | | - 0x8c, 0x62, 0x72, 0x62, 0x1d, 0x89, 0xe8, 0xfa, |
138 | | - 0x52, 0x6d, 0xd8, 0x6a, 0xcf, 0xf6, 0x0c, 0x71, |
139 | | - 0x36, 0xbe, 0x8e, 0x85, |
140 | | - 0x87 // OP_EQUAL |
141 | | - }; |
142 | | - |
143 | | - // Returns the correct donation script based on share version. |
144 | | - // Pre-V36 shares use the original P2PK donation script. |
145 | | - // V36+ shares use the combined P2SH 1-of-2 multisig script. |
| 103 | + // Donation script — delegated to the chain-agnostic single source of |
| 104 | + // truth in core::donation. The bytes are coin-invariant (no network |
| 105 | + // version byte; uniform v36 redeem hash160), so they are no longer |
| 106 | + // duplicated per-coin. See core/donation.hpp for provenance (forrestv |
| 107 | + // P2PK pre-v36; combined P2SH 1-of-2 v36+, operator FLAG6 ruling |
| 108 | + // 2026-06-17 option-b; bitcoin-agnostic re-scope 2026-06-17). |
146 | 109 | static std::vector<unsigned char> get_donation_script(int64_t share_version) |
147 | 110 | { |
148 | | - if (share_version >= 36) |
149 | | - return {COMBINED_DONATION_SCRIPT.begin(), COMBINED_DONATION_SCRIPT.end()}; |
150 | | - return {DONATION_SCRIPT.begin(), DONATION_SCRIPT.end()}; |
| 111 | + return core::donation::get_donation_script(share_version); |
151 | 112 | } |
152 | 113 |
|
153 | 114 | // Message framing prefix — BTC mainnet (jtoomim bitcoin.py:14): |
|
0 commit comments