Problem: sending any Whisper message fails

The error is "PoW too low to compete with other messages"

This has been previously reported in #7144

Solution: prevent the move semantics

The source of the error is in PoolHandle.relay
implementation for NetPoolHandle.

Because of the move semantics, `res` variable is in fact
copied (as it implements Copy) into the closure and for
that reason, the returned result is always `false.
This commit is contained in:
Yurii Rashkovskii 2018-01-01 20:49:32 -08:00
parent 51e6e0b4bd
commit 9c0fceb192
No known key found for this signature in database
GPG Key ID: 1D60D7CFD80845FF

View File

@ -51,7 +51,7 @@ impl PoolHandle for NetPoolHandle {
fn relay(&self, message: Message) -> bool {
let mut res = false;
let mut message = Some(message);
self.net.with_proto_context(whisper_net::PROTOCOL_ID, &mut move |ctx| {
self.net.with_proto_context(whisper_net::PROTOCOL_ID, &mut |ctx| {
if let Some(message) = message.take() {
res = self.handle.post_message(message, ctx);
}