Skip to content

Commit d3b346e

Browse files
author
bch-embedded-steward
committed
bch: bootstrap src/impl/bch skeleton (M2)
Mirror src/impl/btc layout. Stub coin/ + daemon/ + test/ slices. - config_coin.hpp: CashAddr scaffolding, HogEx out-of-scope note - coin/header_chain.hpp: ASERT insertion point (BCH-specific slice 1/2) - coin/template_builder.hpp: CTOR insertion point (slice 2/2), CashTokens note - CMakeLists: -DCOIN_BCH=ON gate (per-coin binary scheme) Per impl plan c2pool-bch-embedded-impl-plan.md v36.
1 parent fce33dd commit d3b346e

6 files changed

Lines changed: 64 additions & 0 deletions

File tree

src/impl/bch/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# c2pool-bch coin module (V36). Built when -DCOIN_BCH=ON.
2+
# Mirrors src/impl/btc/CMakeLists.txt; emits the c2pool-bch binary.
3+
# Per-coin binary scheme: project_v36_per_coin_binary_v37_unified_process.
4+
#
5+
# TODO(M3): add_library(impl_bch ...) sources, link bitcoin_family shared base,
6+
# wire embedded BCHN daemon slice under daemon/. Stub only at M2.
7+
if(COIN_BCH)
8+
message(STATUS "c2pool: BCH coin module enabled (skeleton)")
9+
# add_subdirectory(coin)
10+
# add_subdirectory(daemon)
11+
# add_subdirectory(test)
12+
endif()

src/impl/bch/coin/header_chain.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#pragma once
2+
// BCH header-chain validation. Mirrors src/impl/btc/coin/header_chain.hpp.
3+
//
4+
// >>> ASERT INSERTION POINT (M1 §4.3) <<<
5+
// BCH uses ASERT (aserti3-2d) difficulty adjustment since the Nov 2020
6+
// upgrade, NOT BTC retarget. Net-new c2pool code (one of two BCH-specific
7+
// validation slices). TODO(M3): port aserti3-2d target calc + anchor block.
8+
namespace c2pool::bch { /* TODO(M3): HeaderChain w/ ASERT validate_target() */ }
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
// BCH block-template builder. Mirrors src/impl/btc/coin/template_builder.hpp.
3+
// Must emit p2pool-merged-v36-compatible templates (V36 master compat).
4+
//
5+
// >>> CTOR INSERTION POINT (M1 §4.3) <<<
6+
// BCH requires CTOR: canonical (lexicographic txid) ordering of mempool txs
7+
// in the block body, coinbase first. Net-new c2pool code (second BCH slice).
8+
// TODO(M3): CTOR re-sort pass over selected txs before template assembly.
9+
//
10+
// CashTokens (May 2023) awareness: token-bearing outputs must round-trip
11+
// intact through template assembly. TODO(M3): preserve token prefix bytes.
12+
// HogEx: NOT applicable (see config_coin.hpp scope note).
13+
namespace c2pool::bch { /* TODO(M3): TemplateBuilder w/ CTOR re-sort */ }

src/impl/bch/config_coin.hpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#pragma once
2+
// c2pool-bch :: BCH coin parameters (V36)
3+
// Skeleton per c2pool-bch-embedded-impl-plan.md (frstrtr/the docs/v36) §3.
4+
// Embedded daemon forked from Bitcoin Cash Node (BCHN). SHA256d family.
5+
//
6+
// SCOPE NOTE (M1 §4.2): HogEx is a SmartBCH sidechain construct, NOT BCH
7+
// mainchain. It is explicitly OUT OF SCOPE for this template/coin module.
8+
// Do not add HogEx commitment handling here. See feedback: hogex-not-bch.
9+
//
10+
// CashAddr scaffolding: BCH address encoding diverges from BTC base58/bech32.
11+
// TODO(M3): port CashAddr (prefix "bitcoincash:") encode/decode at vendoring.
12+
13+
namespace c2pool::bch {
14+
15+
struct CoinParams {
16+
// TODO(M3): fill from BCHN chainparams at vendoring (confirm commit/tag).
17+
static constexpr const char* ticker = "BCH";
18+
static constexpr const char* cashaddr_hrp = "bitcoincash";
19+
// ASERT DAA (May 2020) anchor — see coin/header_chain.hpp insertion point.
20+
// CTOR (Nov 2018) canonical tx ordering — see coin/template_builder.hpp.
21+
};
22+
23+
} // namespace c2pool::bch

src/impl/bch/daemon/README.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Embedded BCHN daemon slice (M3). Forked from Bitcoin Cash Node, lowest
2+
divergence from Bitcoin Core (same root as c2pool-btc embedded daemon).
3+
Vendoring policy: NO in-tree vendor of BCHN; reference clone built siblingly,
4+
artifacts into worktree only (M1 §1.1). Scope: SPV + P2P + mempool + template
5+
builder. Confirm BCHN commit/tag at vendoring. Stub placeholder at M2.

src/impl/bch/test/README.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
BCH module tests (M3). Mirror src/impl/btc/test: template_parity_test (vs
2+
p2pool-merged-v36 reference fixtures), share_test. Adds: ASERT vector test,
3+
CTOR ordering test, CashAddr round-trip. Stub placeholder at M2.

0 commit comments

Comments
 (0)