d1088c036e
get_target(): replace hardcoded Bitcoin constants (CHUNK_SIZE, 14-day timespan, module-level MAX_TARGET) with per-chain values from constants.net. Handle POW_GENESIS_BITS so that chains whose genesis nBits differs from target_to_bits(MAX_TARGET) return the correct initial difficulty for period 0. Map checkpoint indices correctly when adj_interval != CHUNK_SIZE. verify_chunk(): add a separate code path for chains where the retarget interval is shorter than CHUNK_SIZE (e.g. BTCP: 120 vs 2016). In this case multiple retargets can occur within a single chunk; because the headers are not yet on disk during verification, reading via read_header() would raise MissingHeader and reject the entire chunk. Fix by reading from the in-memory data buffer via a local helper _read_hdr(), and tracking current_target across period boundaries inline. can_connect(), chainwork_of_header_at_height(): use adj_interval instead of CHUNK_SIZE when computing the difficulty-period index so that BTCP's 120-block retarget windows are respected