|
@ -66,21 +66,31 @@ void WhisperHost::inject(Envelope const& _m, WhisperPeer* _p) |
|
|
m_expiryQueue.insert(make_pair(_m.expiry(), h)); |
|
|
m_expiryQueue.insert(make_pair(_m.expiry(), h)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int rating = 1; // rating is based upon: 1. installed watch; 2. proof of work
|
|
|
|
|
|
|
|
|
|
|
|
//if (bloomfilter.check)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// rating *= 10;
|
|
|
|
|
|
if (_p) // originated externally
|
|
|
DEV_GUARDED(m_filterLock) |
|
|
DEV_GUARDED(m_filterLock) |
|
|
{ |
|
|
{ |
|
|
for (auto const& f: m_filters) |
|
|
for (auto const& f: m_filters) |
|
|
if (f.second.filter.matches(_m)) |
|
|
if (f.second.filter.matches(_m)) |
|
|
for (auto& i: m_watches) |
|
|
for (auto& i: m_watches) |
|
|
if (i.second.id == f.first) |
|
|
if (i.second.id == f.first) |
|
|
|
|
|
{ |
|
|
i.second.changes.push_back(h); |
|
|
i.second.changes.push_back(h); |
|
|
|
|
|
rating *= 10; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
// TODO p2p: capability-based rating
|
|
|
// TODO p2p: capability-based rating
|
|
|
for (auto i: peerSessions()) |
|
|
for (auto i: peerSessions()) |
|
|
{ |
|
|
{ |
|
|
auto w = i.first->cap<WhisperPeer>().get(); |
|
|
auto w = i.first->cap<WhisperPeer>().get(); |
|
|
if (w == _p) |
|
|
if (w == _p) |
|
|
w->addRating(1); |
|
|
w->addRating(rating); |
|
|
else |
|
|
else |
|
|
w->noteNewMessage(h, _m); |
|
|
w->noteNewMessage(h, _m); |
|
|
} |
|
|
} |
|
|