diff options
author | furszy <matiasfurszyfer@protonmail.com> | 2023-01-24 20:49:42 -0300 |
---|---|---|
committer | furszy <matiasfurszyfer@protonmail.com> | 2024-03-12 09:30:42 -0300 |
commit | 331f044e3b49223cedd16803d123c0da9d91d6a2 (patch) | |
tree | a1c7209e41a96639180b4e7a0fa15ba5558146cb /src/index/blockfilterindex.cpp | |
parent | bcbd7eb8d40fbbd0e58c61acef087d65f2047036 (diff) | |
download | bitcoin-331f044e3b49223cedd16803d123c0da9d91d6a2.tar.xz |
index: blockfilter, decouple Write into its own function
Diffstat (limited to 'src/index/blockfilterindex.cpp')
-rw-r--r-- | src/index/blockfilterindex.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/index/blockfilterindex.cpp b/src/index/blockfilterindex.cpp index 65993e830e..1085b4da77 100644 --- a/src/index/blockfilterindex.cpp +++ b/src/index/blockfilterindex.cpp @@ -252,16 +252,21 @@ bool BlockFilterIndex::CustomAppend(const interfaces::BlockInfo& block) BlockFilter filter(m_filter_type, *Assert(block.data), block_undo); + return Write(filter, block.height, filter.ComputeHeader(prev_header)); +} + +bool BlockFilterIndex::Write(const BlockFilter& filter, uint32_t block_height, const uint256& filter_header) +{ size_t bytes_written = WriteFilterToDisk(m_next_filter_pos, filter); if (bytes_written == 0) return false; std::pair<uint256, DBVal> value; - value.first = block.hash; + value.first = filter.GetBlockHash(); value.second.hash = filter.GetHash(); - value.second.header = filter.ComputeHeader(prev_header); + value.second.header = filter_header; value.second.pos = m_next_filter_pos; - if (!m_db->Write(DBHeightKey(block.height), value)) { + if (!m_db->Write(DBHeightKey(block_height), value)) { return false; } |