Detached555#184
Draft
l0rinc wants to merge 15 commits into
Draft
Conversation
Replace local fixture parsing, file reading, string replacement, and error-substring checks with existing helpers where the replacement is direct. Leave stale SRD test additions from the old stack out of the rewrite; this commit only changes helpers used by tests that still exist on current master.
Use existing SplitString and prefix-removal helpers in parser paths where the old code was manually slicing the same strings. Keep current master APIs intact while replacing only the local parsing primitives.
Replace manual prefix and suffix slicing with the existing string helpers in args, IPC, wallet, BIP32, and base encoding paths. The replacements keep the same checked prefixes and accepted padding forms while removing local indexing code.
Replace manual one-off suffix and prefix slicing in script formatting, RPC help, Unix socket paths, byte units, atoi, and args parsing with the existing string helpers. Add focused tests for the formatting and Unix socket cases whose trailing or stripped text is observable.
Replace small local from_chars hex-byte parsers with HexDigit where the code only needs two checked nibbles. The kernel and bitcoin-chainstate helper now reject odd-length input before reading the second nibble, matching the invalid-input path instead of depending on the old loop bounds.
Use Join or Cat in formatting paths where the old code only handled separators or appended one local vector. Keep side-effecting and loop-carried formatting paths out of this rewrite so the helper use remains a direct replacement.
Replace local duration count conversions with existing helpers in time, networking, mempool, and focused tests. Skip the stale fuzz-duration overload from the old stack because current master already has a templated ConsumeDuration helper.
Replace cache-size multiplications in DB and index tests with the existing MiB literal so the intended unit is explicit. Only the include context needed adjustment while rebasing; the dropped txindex shutdown reproducer's time include was not carried forward.
Use existing overflow helpers where the code was open-coding saturated length addition or checked compact-block delta accumulation. The focused base58 assertion pins the saturated length behavior touched by this cleanup.
Reuse ClearShrink, EncodeHexTx, and ToByteVector in paths that were spelling out equivalent vector or transaction-hex construction. Keep the changes scoped to direct replacements; broader helper rewrites are left out when the call sites become less direct.
Use existing byte-vector and byte-span helpers in PSBT, descriptor/signing, script, and ASMap code where they directly replace manual byte range construction. Only direct production replacements are carried from the old stack; broad test-only byte churn is left out.
Use MakeByteSpan and MakeWritableByteSpan where the code was manually constructing equivalent byte spans for obfuscation, random output, and wallet migration parsing. The include conflict was resolved to the span dependency needed by the retained helper use.
Use existing span and Vector helpers in script, streams, validation, and tx download code where they replace local one-element or byte-span construction. Keep the changes as direct expression rewrites without introducing new helper layers.
Use byte span helper wrappers in serialization and solver code where they replace manual byte pointer or one-element vector construction.
Replace repeated unsigned-char pointer casts with UCharCast in serialization, hashing, random-env, and kernel wrapper boundaries. This keeps the cast points explicit while removing local reinterpret_cast spelling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.