Skip to content

Commit fc4ee9a

Browse files
authored
Merge pull request #131 from frstrtr/dgb/oracle-conformance
dgb: conform share/coin params to p2pool-dgb-scrypt oracle
2 parents 78dd983 + c51f39b commit fc4ee9a

3 files changed

Lines changed: 32 additions & 27 deletions

File tree

src/impl/dgb/config_coin.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace config
2727
} // config
2828

2929
/// DigiByte Scrypt coin parameters.
30-
/// Source: p2pool-merged-v36/p2pool/bitcoin/networks/digibyte.py
30+
/// Source of truth: p2pool-dgb-scrypt oracle bitcoin/networks/digibyte.py
3131
///
3232
/// DGB uses 5 algorithms rotating every 15 seconds. Scrypt is one of them.
3333
/// When running as a P2Pool parent chain, we request getblocktemplate with
@@ -49,8 +49,10 @@ class CoinParams
4949
static constexpr uint16_t MAINNET_RPC_PORT = 14024;
5050
static constexpr uint16_t TESTNET_RPC_PORT = 14025;
5151

52-
// Block timing: 75s total / 5 algos = 15s per algo
53-
static constexpr uint32_t BLOCK_PERIOD = 15; // seconds (Scrypt algo rotation)
52+
// Block timing: Scrypt-only parent block period (oracle PARENT.BLOCK_PERIOD).
53+
// DGB mints a block ~every 15s across 5 rotating algos; one algo (Scrypt)
54+
// lands ~every 75s, which is the period a Scrypt-only parent observes.
55+
static constexpr uint32_t BLOCK_PERIOD = 75; // seconds (Scrypt algo period)
5456

5557
// -----------------------------------------------------------------------
5658
// Address encoding
@@ -71,7 +73,7 @@ class CoinParams
7173

7274
// -----------------------------------------------------------------------
7375
// DGB subsidy schedule (3-phase decay)
74-
// Source: p2pool-merged-v36/p2pool/bitcoin/networks/digibyte.py
76+
// Source: p2pool-dgb-scrypt oracle bitcoin/networks/digibyte.py
7577
// -----------------------------------------------------------------------
7678
static uint64_t subsidy(uint32_t height)
7779
{

src/impl/dgb/config_pool.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ class PoolConfig : protected core::Fileconfig
2828

2929
// -----------------------------------------------------------------------
3030
// Static DGB Scrypt p2pool network constants
31-
// Source: p2pool-merged-v36/p2pool/networks/digibyte.py
31+
// Source of truth: p2pool-dgb-scrypt oracle networks/digibyte.py
3232
// -----------------------------------------------------------------------
3333
static constexpr uint16_t P2P_PORT = 5024;
34-
static constexpr uint32_t SPREAD = 30;
35-
static constexpr uint32_t TARGET_LOOKBEHIND = 200;
34+
static constexpr uint32_t SPREAD = 24;
35+
static constexpr uint32_t TARGET_LOOKBEHIND = 100;
3636
static constexpr uint32_t MINIMUM_PROTOCOL_VERSION = 1700; // floor (p2pool-dgb-scrypt digibyte.py NEW_MIN)
3737
static constexpr uint32_t ADVERTISED_PROTOCOL_VERSION = 3301; // advertised capability (p2pool-dgb-scrypt p2p.py VERSION)
38-
static constexpr uint32_t SEGWIT_ACTIVATION_VERSION = 17;
39-
static constexpr uint32_t BLOCK_MAX_SIZE = 1000000;
40-
static constexpr uint32_t BLOCK_MAX_WEIGHT = 4000000;
38+
static constexpr uint32_t SEGWIT_ACTIVATION_VERSION = 35;
39+
static constexpr uint32_t BLOCK_MAX_SIZE = 32000000;
40+
static constexpr uint32_t BLOCK_MAX_WEIGHT = 128000000;
4141

4242
// Mainnet constants
43-
static constexpr uint32_t SHARE_PERIOD = 25; // seconds
44-
static constexpr uint32_t CHAIN_LENGTH = 8640; // ~24 hours at 25s
45-
static constexpr uint32_t REAL_CHAIN_LENGTH = 8640;
43+
static constexpr uint32_t SHARE_PERIOD = 15; // seconds (oracle SHARE_PERIOD)
44+
static constexpr uint32_t CHAIN_LENGTH = 2880; // 12*60*60//15 — ~12h at 15s
45+
static constexpr uint32_t REAL_CHAIN_LENGTH = 2880;
4646

4747
// Testnet constants
4848
static constexpr uint32_t TESTNET_SHARE_PERIOD = 4;
@@ -124,7 +124,7 @@ class PoolConfig : protected core::Fileconfig
124124
}
125125

126126
static inline const std::set<std::string> SOFTFORKS_REQUIRED = {
127-
"csv", "segwit"
127+
"nversionbips", "csv", "segwit", "reservealgo", "odo", "taproot"
128128
};
129129

130130
// Bootstrap peers for the DGB Scrypt p2pool network

src/impl/dgb/params.hpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ inline core::CoinParams make_coin_params(bool testnet)
3030

3131
// ===== Coin-level (net.PARENT) — from dgb::CoinParams (config_coin.hpp) =====
3232
p.symbol = "DGB";
33-
p.block_period = CoinParams::BLOCK_PERIOD; // 15s (Scrypt algo rotation slot)
33+
p.block_period = CoinParams::BLOCK_PERIOD; // 75s (Scrypt-only parent period, oracle PARENT.BLOCK_PERIOD)
3434

3535
// Address encoding
3636
if (testnet) {
@@ -42,8 +42,10 @@ inline core::CoinParams make_coin_params(bool testnet)
4242
p.address_p2sh_version = CoinParams::ADDRESS_P2SH_VERSION; // 63 (S...)
4343
p.bech32_hrp = CoinParams::BECH32_HRP; // "dgb"
4444
}
45-
// address_p2sh_version2: DGB legacy P2SH prefix (5). Affects address-parse
46-
// leniency only, NOT block/share validation. [confirm-vs-oracle]
45+
// address_p2sh_version2: secondary P2SH prefix for parse leniency only, NOT
46+
// block/share validation. The oracle defines a SINGLE P2SH version (63); it
47+
// is silent on a second prefix, so 5 (DGB legacy) is NOT oracle-sourced.
48+
// [confirm-vs-oracle] kept open — see oracle-conformance report.
4749
p.address_p2sh_version2 = testnet ? 0 : 5;
4850

4951
// PoW: Scrypt work, SHA256d block identity (same shape as LTC)
@@ -55,31 +57,32 @@ inline core::CoinParams make_coin_params(bool testnet)
5557
return CoinParams::subsidy(height);
5658
};
5759

58-
// Dust threshold: 0.001 DGB. Local relay policy, not consensus. [confirm-vs-oracle]
60+
// Dust threshold: 0.001 DGB = 100000 sat. Confirmed vs oracle DUST_THRESHOLD
61+
// (0.001e8). Local relay policy, not consensus.
5962
p.dust_threshold = 100000;
6063

61-
// Softforks — from PoolConfig SSOT (DGB oracle: csv + segwit)
64+
// Softforks — from PoolConfig SSOT (oracle: nversionbips,csv,segwit,reservealgo,odo,taproot)
6265
p.softforks_required = PoolConfig::SOFTFORKS_REQUIRED;
63-
p.segwit_activation_version = PoolConfig::SEGWIT_ACTIVATION_VERSION; // 17
66+
p.segwit_activation_version = PoolConfig::SEGWIT_ACTIVATION_VERSION; // 35
6467

6568
// ===== Pool-level (net) — from dgb::PoolConfig (config_pool.hpp) =====
6669
p.p2p_port = PoolConfig::P2P_PORT; // 5024 (DGB sharechain P2P)
67-
// worker_port: DGB Stratum port. Operator-overridable via pool.yaml; the
68-
// default below is provisional pending oracle confirmation. [confirm-vs-oracle]
70+
// worker_port: DGB Stratum port. Confirmed vs oracle WORKER_PORT = 5025.
71+
// Operator-overridable via pool.yaml.
6972
p.worker_port = 5025;
7073

7174
if (testnet) {
7275
p.share_period = PoolConfig::TESTNET_SHARE_PERIOD; // 4
7376
p.chain_length = PoolConfig::TESTNET_CHAIN_LENGTH; // 400
7477
p.real_chain_length = PoolConfig::TESTNET_REAL_CHAIN_LENGTH; // 400
7578
} else {
76-
p.share_period = PoolConfig::SHARE_PERIOD; // 25
77-
p.chain_length = PoolConfig::CHAIN_LENGTH; // 8640
78-
p.real_chain_length = PoolConfig::REAL_CHAIN_LENGTH; // 8640
79+
p.share_period = PoolConfig::SHARE_PERIOD; // 15
80+
p.chain_length = PoolConfig::CHAIN_LENGTH; // 2880
81+
p.real_chain_length = PoolConfig::REAL_CHAIN_LENGTH; // 2880
7982
}
8083

81-
p.target_lookbehind = PoolConfig::TARGET_LOOKBEHIND; // 200
82-
p.spread = PoolConfig::SPREAD; // 30
84+
p.target_lookbehind = PoolConfig::TARGET_LOOKBEHIND; // 100
85+
p.spread = PoolConfig::SPREAD; // 24
8386
p.minimum_protocol_version = PoolConfig::MINIMUM_PROTOCOL_VERSION; // 1700 floor
8487
p.block_max_size = PoolConfig::BLOCK_MAX_SIZE;
8588
p.block_max_weight = PoolConfig::BLOCK_MAX_WEIGHT;

0 commit comments

Comments
 (0)