Skip to content

Commit

Permalink
fix filter construction
Browse files Browse the repository at this point in the history
wasnt encoding anything, doh
  • Loading branch information
josibake committed Jan 27, 2024
1 parent c12f903 commit a6023c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/blockfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static InputsFilter SilentPaymentFilterElements(const CBlock& block,
CPubKey final{inputs_hash.UnhashedECDH(input_pubkeys_sum)};
elements.addElement(final.data());
}

elements.Encode();
return elements;
}

Expand Down
16 changes: 8 additions & 8 deletions src/blockfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,14 @@ class InputsFilter {
// Adds an element to the filter
void addElement(const Element& element) {
elements.push_back(element);
encode();
}

// Encodes the elements into m_encoded
void Encode() {
m_encoded.clear();
for (const auto& element : elements) {
m_encoded.insert(m_encoded.end(), element.data, element.data + 33);
}
}

// Returns the encoded data
Expand All @@ -117,13 +124,6 @@ class InputsFilter {
std::vector<Element> elements; // Stores the elements
std::vector<unsigned char> m_encoded; // Encoded block of bytes

// Encodes the elements into m_encoded
void encode() {
m_encoded.clear();
for (const auto& element : elements) {
m_encoded.insert(m_encoded.end(), element.data, element.data + 33);
}
}
// decode into elements from a encoded InputsFilter
void decode() {
elements.clear();
Expand Down

0 comments on commit a6023c8

Please sign in to comment.