Repository: bitcoin/bitcoin
File: src/kernel/bitcoinkernel_wrapper.h (C/C++)

Code before:
        return static_cast<BlockValidationResult>(btck_block_validation_state_get_block_validation_result(impl()));
    }
};

class BlockValidationStateView : public View<btck_BlockValidationState>, public BlockValidationStateApi<BlockValidationStateView>
{
public:
    explicit BlockValidationStateView(const btck_BlockValidationState* ptr) : View{ptr} {}
};

class BlockValidationState : public Handle<btck_BlockValidationState, btck_block_validation_state_copy, btck_block_validation_state_destroy>, public BlockValidationStateApi<BlockValidationState>
{
public:
    explicit BlockValidationState() : Handle{btck_block_validation_state_create()} {}

    BlockValidationState(const BlockValidationStateView& view) : Handle{view} {}
};

class ValidationInterface
{
public:
    virtual ~ValidationInterface() = default;

    virtual void BlockChecked(Block block, const BlockValidationStateView state) {}

    virtual void PowValidBlock(BlockTreeEntry entry, Block block) {}

    virtual void BlockConnected(Block block, BlockTreeEntry entry) {}

    virtual void BlockDisconnected(Block block, BlockTreeEntry entry) {}
};

class ChainParams : public Handle<btck_ChainParameters, btck_chain_parameters_copy, btck_chain_parameters_destroy>
{
public:
    ChainParams(ChainType chain_type)
        : Handle{btck_chain_parameters_create(static_cast<btck_ChainType>(chain_type))} {}
};

class ContextOptions : public UniqueHandle<btck_ContextOptions, btck_context_options_destroy>
{
public:
    ContextOptions() : UniqueHandle{btck_context_options_create()} {}

    void SetChainParams(ChainParams& chain_params)
    {
        btck_context_options_set_chainparams(get(), chain_params.get());
    }

    template <typename T>
    void SetNotifications(std::shared_ptr<T> notifications)

Review comment (suggestion):
I think we can drop `const`. We haven't enforced it for `BlockTreeEntry` which is also a view. (Also for `BlockChecked` definitions in `bitcoin-chainstate.cpp` and `test_kernel.cpp`)
It seems throughout the wrapper, we haven't stated const-ness for functions returning views either. 

Code after:
    ValidationMode GetValidationMode() const
    {
        return static_cast<ValidationMode>(btck_block_validation_state_get_validation_mode(impl()));
    }

    BlockValidationResult GetBlockValidationResult() const
    {
        return static_cast<BlockValidationResult>(btck_block_validation_state_get_block_validation_result(impl()));
    }
};

class BlockValidationStateView : public View<btck_BlockValidationState>, public BlockValidationStateApi<BlockValidationStateView>
{
public:
    explicit BlockValidationStateView(const btck_BlockValidationState* ptr) : View{ptr} {}
};

class BlockValidationState : public Handle<btck_BlockValidationState, btck_block_validation_state_copy, btck_block_validation_state_destroy>, public BlockValidationStateApi<BlockValidationState>
{
public:
    explicit BlockValidationState() : Handle{btck_block_validation_state_create()} {}

    BlockValidationState(const BlockValidationStateView& view) : Handle{view} {}
};

class ValidationInterface
{
public:
    virtual ~ValidationInterface() = default;

    virtual void BlockChecked(Block block, BlockValidationStateView state) {}

    virtual void PowValidBlock(BlockTreeEntry entry, Block block) {}

    virtual void BlockConnected(Block block, BlockTreeEntry entry) {}

    virtual void BlockDisconnected(Block block, BlockTreeEntry entry) {}
};

class ChainParams : public Handle<btck_ChainParameters, btck_chain_parameters_copy, btck_chain_parameters_destroy>
{
public:
    ChainParams(ChainType chain_type)
        : Handle{btck_chain_parameters_create(static_cast<btck_ChainType>(chain_type))} {}
};

class ContextOptions : public UniqueHandle<btck_ContextOptions, btck_context_options_destroy>
{
public:
    ContextOptions() : UniqueHandle{btck_context_options_create()} {}