| 144 | } |
| 145 | |
| 146 | bool BlockFilterIndex::ReadFilterFromDisk(const FlatFilePos& pos, BlockFilter& filter) const |
| 147 | { |
| 148 | CAutoFile filein(m_filter_fileseq->Open(pos, true), SER_DISK, CLIENT_VERSION); |
| 149 | if (filein.IsNull()) { |
| 150 | return false; |
| 151 | } |
| 152 | |
| 153 | uint256 block_hash; |
| 154 | std::vector<uint8_t> encoded_filter; |
| 155 | try { |
| 156 | filein >> block_hash >> encoded_filter; |
| 157 | filter = BlockFilter(GetFilterType(), block_hash, std::move(encoded_filter)); |
| 158 | } |
| 159 | catch (const std::exception& e) { |
| 160 | return error("%s: Failed to deserialize block filter from disk: %s", __func__, e.what()); |
| 161 | } |
| 162 | |
| 163 | return true; |
| 164 | } |
| 165 | |
| 166 | size_t BlockFilterIndex::WriteFilterToDisk(FlatFilePos& pos, const BlockFilter& filter) |
| 167 | { |
nothing calls this directly
no test coverage detected