Bitcoin full node and query server

Mar 15, 2024

View in context in the libbitcoin Slack #general mirror.

evoskuil19:47
That's the before and after the fix. Just needed to obtain logical size outside of access construction. That's because of the interaction of these two methods, and the fact that access() takes a shared lock until destruct.
size_t map::size() const NOEXCEPT
{
    std::shared_lock field_lock(field_mutex_);
    return logical_;
}

size_t map::allocate(size_t chunk) NOEXCEPT
{
    std::unique_lock field_lock(field_mutex_);
    if (!loaded_ || is_add_overflow(logical_, chunk))
        return storage::eof;

    auto end = logical_ + chunk;
    if (end > capacity_)
    {
        const auto size = to_capacity(end);
        std::unique_lock remap_lock(remap_mutex_);
        if (!remap_(size))
            return storage::eof;
    }

    std::swap(logical_, end);
    return end;
}
(edited)