|
|
@ -77,9 +77,58 @@ vector<LogBloom> LogFilter::bloomPossibilities() const |
|
|
|
{ |
|
|
|
// return combination of each of the addresses/topics
|
|
|
|
vector<LogBloom> ret; |
|
|
|
// TODO proper combinatorics.
|
|
|
|
for (auto i: m_addresses) |
|
|
|
|
|
|
|
// | every address with every topic
|
|
|
|
for (auto const& i: m_addresses) |
|
|
|
{ |
|
|
|
// 1st case, there are addresses and topics
|
|
|
|
//
|
|
|
|
// m_addresses = [a0, a1];
|
|
|
|
// m_topics = [[t0], [t1a, t1b], [], []];
|
|
|
|
//
|
|
|
|
// blooms = [
|
|
|
|
// a0 | t0, a0 | t1a | t1b,
|
|
|
|
// a1 | t0, a1 | t1a | t1b
|
|
|
|
// ]
|
|
|
|
//
|
|
|
|
for (auto const& t: m_topics) |
|
|
|
if (t.size()) |
|
|
|
{ |
|
|
|
LogBloom b = LogBloom().shiftBloom<3>(dev::sha3(i)); |
|
|
|
for (auto const &j: t) |
|
|
|
b = b.shiftBloom<3>(dev::sha3(j)); |
|
|
|
ret.push_back(b); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 2nd case, there are no topics
|
|
|
|
//
|
|
|
|
// m_addresses = [a0, a1];
|
|
|
|
// m_topics = [[t0], [t1a, t1b], [], []];
|
|
|
|
//
|
|
|
|
// blooms = [a0, a1];
|
|
|
|
//
|
|
|
|
if (!ret.size()) |
|
|
|
for (auto const& i: m_addresses) |
|
|
|
ret.push_back(LogBloom().shiftBloom<3>(dev::sha3(i))); |
|
|
|
|
|
|
|
// 3rd case, there are no addresses, at least create blooms from topics
|
|
|
|
//
|
|
|
|
// m_addresses = [];
|
|
|
|
// m_topics = [[t0], [t1a, t1b], [], []];
|
|
|
|
//
|
|
|
|
// blooms = [t0, t1a | t1b];
|
|
|
|
//
|
|
|
|
if (!m_addresses.size()) |
|
|
|
for (auto const& t: m_topics) |
|
|
|
if (t.size()) |
|
|
|
{ |
|
|
|
LogBloom b; |
|
|
|
for (auto const &j: t) |
|
|
|
b = b.shiftBloom<3>(dev::sha3(j)); |
|
|
|
ret.push_back(b); |
|
|
|
} |
|
|
|
|
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|