Skip to content

Conversation

@l0rinc
Copy link
Owner

@l0rinc l0rinc commented Dec 12, 2025

This adds a consteval constructor to transaction_identifier (Txid/Wtxid) to allow parsing hex strings at compile-time.
This replaces runtime FromHex checks in tests, ensuring that malformed hardcoded hashes cause build failures rather than runtime test failures.

Test variables are explicitly marked constexpr. This is required to workaround a regression in GCC 14 (Bug 117501) where the compiler incorrectly flags consteval initialization of non-constexpr variables as "statements with no effect".

GCC Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117501
Reproducer: https://godbolt.org/z/xb5TMaPs6

@l0rinc l0rinc changed the title consteval explicit transaction_identifier Lőrinc A minute ago consteval explicit transaction_identifier Dec 12, 2025
…ructor

This adds a `consteval` constructor to `transaction_identifier` (Txid/Wtxid) to allow parsing hex strings at compile-time.
This replaces runtime `FromHex` checks in tests, ensuring that malformed hardcoded hashes cause build failures rather than runtime test failures.

Test variables are explicitly marked `constexpr`. This is required to workaround a regression in GCC 14 (Bug 117501) where the compiler incorrectly flags `consteval` initialization of non-`constexpr` variables as "statements with no effect".

GCC Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117501
Reproducer: https://godbolt.org/z/xb5TMaPs6

Co-authored-by: rustaceanrob <rob.netzke@gmail.com>
@l0rinc l0rinc changed the title consteval explicit transaction_identifier refactor: Add compile-time-checked hex transaction_identifier constructor Dec 12, 2025
@l0rinc l0rinc closed this Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants