While going through the codebase , I saw a TODO mentioning to organize constants.The current implementation of constants within the python-bitcoin-utils library is functional but lacks a structured organization. This makes it harder for new contributors to navigate the codebase and for existing contributors to maintain and update constant values efficiently. To address this issue, I propose reorganizing all constants into clearly defined sections based on their functionality and relevance to different parts of the Bitcoin protocol.
Proposed Changes:Address Types: Group all constants defining Bitcoin address types (P2PKH, P2SH, SegWit versions) in one section to centralize address-related data.
Transaction Signature Types: Organize all transaction signature-related constants (SIGHASH types) into a dedicated section for better visibility and maintenance.
Timelock and Replace-by-Fee (RBF) Constants: Create a section for constants that handle transaction timing features like timelocks and the RBF protocol, enhancing the structure for transaction policy implementations.
Transaction Versions and Scripts: Assemble constants related to transaction versions and specific script settings in a distinct section to aid in transaction formatting and validation processes.
Monetary Constants: Consolidate all monetary-related constants, such as SATOSHIS_PER_BITCOIN, into one section to streamline financial calculations and updates.
While going through the codebase , I saw a TODO mentioning to organize constants.The current implementation of constants within the python-bitcoin-utils library is functional but lacks a structured organization. This makes it harder for new contributors to navigate the codebase and for existing contributors to maintain and update constant values efficiently. To address this issue, I propose reorganizing all constants into clearly defined sections based on their functionality and relevance to different parts of the Bitcoin protocol.
Proposed Changes: Address Types: Group all constants defining Bitcoin address types (P2PKH, P2SH, SegWit versions) in one section to centralize address-related data.
Transaction Signature Types: Organize all transaction signature-related constants (SIGHASH types) into a dedicated section for better visibility and maintenance.
Timelock and Replace-by-Fee (RBF) Constants: Create a section for constants that handle transaction timing features like timelocks and the RBF protocol, enhancing the structure for transaction policy implementations.
Transaction Versions and Scripts: Assemble constants related to transaction versions and specific script settings in a distinct section to aid in transaction formatting and validation processes.
Monetary Constants: Consolidate all monetary-related constants, such as SATOSHIS_PER_BITCOIN, into one section to streamline financial calculations and updates.