Skip to content

Commit a4f5cc1

Browse files
quantumclaude
authored andcommitted
fix: remove bitcoin_genesis_tx and unify all networks to use dash_genesis_tx
- Remove inappropriate bitcoin_genesis_tx function that was providing Bitcoin genesis data - Update devnet to use dash_genesis_tx like all other networks (mainnet, testnet, regtest) - Update devnet merkle root to match Dash genesis transaction - Update devnet ChainHash constant to match new block hash - Update devnet test expectations to use Dash genesis values - All networks now consistently use Dash-specific genesis data 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 80b0efd commit a4f5cc1

File tree

1 file changed

+8
-47
lines changed

1 file changed

+8
-47
lines changed

dash/src/blockdata/constants.rs

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -108,49 +108,10 @@ fn dash_genesis_tx() -> Transaction {
108108
ret
109109
}
110110

111-
/// Constructs and returns the coinbase (and only) transaction of the Bitcoin genesis block (used by devnet).
112-
fn bitcoin_genesis_tx() -> Transaction {
113-
// Base
114-
let mut ret = Transaction {
115-
version: 1,
116-
lock_time: absolute::LockTime::ZERO.to_consensus_u32(),
117-
input: vec![],
118-
output: vec![],
119-
special_transaction_payload: None,
120-
};
121-
122-
// Inputs
123-
let in_script = script::ScriptBuf::from(hex!(
124-
"04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73"
125-
).to_vec());
126-
ret.input.push(TxIn {
127-
previous_output: OutPoint::null(),
128-
script_sig: in_script,
129-
sequence: 0xFFFFFFFF,
130-
witness: Witness::default(),
131-
});
132-
133-
// Outputs
134-
let script_bytes = hex!(
135-
"04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"
136-
);
137-
let out_script =
138-
script::Builder::new().push_slice(script_bytes).push_opcode(OP_CHECKSIG).into_script();
139-
ret.output.push(TxOut {
140-
value: 50 * COIN_VALUE,
141-
script_pubkey: out_script,
142-
});
143-
144-
// end
145-
ret
146-
}
147111

148112
/// Constructs and returns the genesis block.
149113
pub fn genesis_block(network: Network) -> Block {
150-
let txdata = match network {
151-
Network::Devnet => vec![bitcoin_genesis_tx()],
152-
_ => vec![dash_genesis_tx()],
153-
};
114+
let txdata = vec![dash_genesis_tx()];
154115

155116
match network {
156117
Network::Dash => {
@@ -188,9 +149,9 @@ pub fn genesis_block(network: Network) -> Block {
188149
}
189150
}
190151
Network::Devnet => {
191-
// Devnet merkle root - Note: bytes are reversed for internal representation
152+
// Devnet merkle root (same as mainnet/testnet - all use Dash genesis tx) - Note: bytes are reversed for internal representation
192153
let merkle_bytes =
193-
hex!("3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a");
154+
hex!("c762a6567f3cc092f0684bb62b7e00a84890b990f07cc71a6bb58d64b98e02e0");
194155
let merkle_root = sha256d::Hash::from_slice(&merkle_bytes).unwrap().into();
195156
Block {
196157
header: block::Header {
@@ -246,9 +207,9 @@ impl ChainHash {
246207
]);
247208
/// `ChainHash` for devnet dash.
248209
pub const DEVNET: Self = Self([
249-
0xa4, 0x77, 0x55, 0xbe, 0x79, 0x25, 0x96, 0x6f, 0x83, 0xb5, 0xb1, 0xa4, 0xcc, 0xd1, 0xca,
250-
0x69, 0x1d, 0xc5, 0xeb, 0xf0, 0xfa, 0xb3, 0xe0, 0x06, 0x2e, 0xee, 0x28, 0x88, 0x17, 0xd7,
251-
0x0c, 0x58,
210+
0x4e, 0x5f, 0x93, 0x0c, 0x5d, 0x73, 0xa8, 0x79, 0x2f, 0xa6, 0x81, 0xba, 0x8c, 0x5e, 0xaf,
211+
0x74, 0xaa, 0x63, 0x97, 0x4a, 0x5b, 0x1f, 0x59, 0x8d, 0xd5, 0x08, 0x02, 0x9a, 0xee, 0x70,
212+
0x16, 0x7b,
252213
]);
253214
/// `ChainHash` for regtest dash.
254215
pub const REGTEST: Self = Self([
@@ -361,14 +322,14 @@ mod test {
361322
assert_eq!(genesis_block.header.prev_blockhash, Hash::all_zeros());
362323
assert_eq!(
363324
genesis_block.header.merkle_root.to_string(),
364-
"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"
325+
"e0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"
365326
);
366327
assert_eq!(genesis_block.header.time, 1598918400);
367328
assert_eq!(genesis_block.header.bits, CompactTarget::from_consensus(0x1e0377ae));
368329
assert_eq!(genesis_block.header.nonce, 52613770);
369330
assert_eq!(
370331
genesis_block.header.block_hash().to_string(),
371-
"a47755be7925966f83b5b1a4ccd1ca691dc5ebf0fab3e0062eee288817d70c58"
332+
"4e5f930c5d73a8792fa681ba8c5eaf74aa63974a5b1f598dd508029aee70167b"
372333
);
373334
}
374335

0 commit comments

Comments
 (0)