-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Problem: sending any Whisper message fails #7421
Conversation
The error is "PoW too low to compete with other messages" This has been previously reported in openethereum#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.
It looks like @yrashk signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
cc @rphmeier |
@@ -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| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a tricky one. nice catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little disappointed that rustc doesn't give you a warning for unused_mut when the variable is only copied into a closure.
Minimal playpen: https://play.rust-lang.org/?gist=c66bc6098aeacddb71550878c0d887f9&version=stable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @yrashk for fixing this critical issue for the whole ethereum community. |
@rstormsf Thanks for alert :) We will try. |
@ensrationis actually we have found more issues with Whisper in parity. False alarm :-( |
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 factcopied (as it implements Copy) into the closure and for
that reason, the returned result is always `false.
I am not sure what's the best way to cover this with a test. Any suggestions?