|
11 | 11 |
|
12 | 12 | #include <gtest/gtest.h> |
13 | 13 |
|
| 14 | +#include <algorithm> |
| 15 | +#include <array> |
| 16 | + |
14 | 17 | #include <impl/dgb/config_pool.hpp> |
15 | 18 | #include <impl/dgb/config_coin.hpp> |
16 | 19 | #include <impl/dgb/share.hpp> |
@@ -79,6 +82,36 @@ TEST(DGB_share_test, OracleDonationScript) |
79 | 82 | EXPECT_EQ(dgb::PoolConfig::get_donation_script(36).size(), 23u); // v36 combined P2SH |
80 | 83 | } |
81 | 84 |
|
| 85 | +// v36 combined-donation P2SH — FULL 23-byte pin (bucket-2 standardization). |
| 86 | +// OracleDonationScript above pins only the SIZE of the v36 path; a drift in the |
| 87 | +// 20-byte hash160 would slip past it. This locks the exact bytes get_donation_ |
| 88 | +// script(36) emits: OP_HASH160 PUSH20 <hash160> OP_EQUAL, where the hash160 is |
| 89 | +// the canonical FLAG6 unified cross-coin v36 donation (1-of-2 forrestv+c2pool |
| 90 | +// dev key). 3-bucket rule: the v36 donation target is BUCKET 2 (v36-native |
| 91 | +// shared structure), so this hash is byte-identical across ALL v36 coins — the |
| 92 | +// same 8c627262… as src/impl/ltc/config_pool.hpp COMBINED_DONATION_SCRIPT. |
| 93 | +// Guards against a coin-local fork of the donation target during the transition. |
| 94 | +TEST(DGB_share_test, V36CombinedDonationScriptBytes) |
| 95 | +{ |
| 96 | + // hash160 of the FLAG6 1-of-2 P2MS redeem script (forrestv + c2pool dev). |
| 97 | + static constexpr std::array<uint8_t, 23> kExpected = { |
| 98 | + 0xa9, 0x14, // OP_HASH160 PUSH20 |
| 99 | + 0x8c, 0x62, 0x72, 0x62, 0x1d, 0x89, 0xe8, 0xfa, |
| 100 | + 0x52, 0x6d, 0xd8, 0x6a, 0xcf, 0xf6, 0x0c, 0x71, |
| 101 | + 0x36, 0xbe, 0x8e, 0x85, |
| 102 | + 0x87 // OP_EQUAL |
| 103 | + }; |
| 104 | + |
| 105 | + const auto got = dgb::PoolConfig::get_donation_script(36); |
| 106 | + ASSERT_EQ(got.size(), kExpected.size()); |
| 107 | + for (size_t i = 0; i < kExpected.size(); ++i) |
| 108 | + EXPECT_EQ(got[i], kExpected[i]) << "donation byte " << i << " drifted"; |
| 109 | + |
| 110 | + // The raw constant the switch returns must match too (no copy divergence). |
| 111 | + EXPECT_TRUE(std::equal(kExpected.begin(), kExpected.end(), |
| 112 | + dgb::PoolConfig::COMBINED_DONATION_SCRIPT.begin())); |
| 113 | +} |
| 114 | + |
82 | 115 | // Address byte versions (D… P2PKH / S… P2SH) — DigiByte mainnet. |
83 | 116 | TEST(DGB_share_test, AddressVersions) |
84 | 117 | { |
|
0 commit comments