kernel: Add kernel library context object

The context introduced here holds the objects that will be required for
running validation tasks, such as the chosen chain parameters, callbacks
for validation events, and interrupt handling. These will be used by the
chainstate manager introduced in subsequent commits.

This commit also introduces conventions for defining option objects. A
common pattern throughout the C header will be:
```
options = object_option_create();
object = object_create(options);
```
This allows for more consistent usage of a "builder pattern" for
objects where options can be configured independently from
instantiation.
This commit is contained in:
TheCharlatan
2024-06-03 14:35:47 +02:00
parent 28d679bad9
commit 337ea860df
4 changed files with 170 additions and 0 deletions

View File

@@ -381,3 +381,17 @@ BOOST_AUTO_TEST_CASE(logging_tests)
}
Logger logger{std::make_unique<TestLog>()};
}
BOOST_AUTO_TEST_CASE(btck_context_tests)
{
{ // test default context
Context context{};
Context context2{};
CheckHandle(context, context2);
}
{ // test with context options
ContextOptions options{};
Context context{options};
}
}