Skip to content

Refactor: Project File Structure Organization #21

@alexanderwiederin

Description

@alexanderwiederin

Refactor: Project File Structure Organization

Add standardized file structure and organization to improve project maintainability and navigation.

Current State

The project currently lacks a clear file structure, which makes it hard to read and contribute to.

Proposed Structure (preliminary)

src/
├── lib.rs                    # c_serialize, KernelError
├── ffi/                      # Foreign Function Interface / C bindings
│   ├── mod.rs
│   ├── c_helpers.rs          # Utilities for C callback patterns (incl. cast_string)
│   └── constants.rs          # C-side constants
├── core/                     # Core Bitcoin data types and consensus logic
│   ├── mod.rs
│   ├── block.rs              # Block, BlockHash, BlockSpentOutputs, TransactionSpentOutputs
│   ├── transaction.rs        # Transaction, TxOut, Coin
│   ├── script.rs             # ScriptPubkey
│   └── verify.rs             # Script verification logic, flags, ScriptVerifyStatus ScriptVerifyError
├── state/                    # Chainstate & contextual info
│   ├── mod.rs
│   ├── chainstate.rs         # ChainstateManager
│   ├── context.rs            # Context, ContextBuilder, ChainType
│   └── chain.rs              # Chain, ChainIterator
├── notifications/            # Callback interfaces for notifications
│   ├── mod.rs
│   ├── kernel.rs             # KernelNotificationInterface callbacks
│   ├── validation.rs         # ValidationInterface callbacks
│   └── types.rs              # SynchronizationState, ValidationMode, BlockValidationResult, Warning
└── log/
   ├── mod.rs
   └── logging.rs            # Logger, LogLevel, LogCategory and logging helpers (e.g. disable_logging)

Implementation Considerations

  • Try to maintain backward compatibility during any restructuring

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions