Merge pull request #135 from ZcashFoundation/130
On receipt of a Filter(Load|Add|Clear) message, disconnect from peer
This commit is contained in:
parent
d559a3fa52
commit
82e246d87b
|
@ -40,6 +40,10 @@ pub enum PeerError {
|
|||
/// to shed load.
|
||||
#[error("Internal services over capacity")]
|
||||
Overloaded,
|
||||
/// A peer sent us a message we don't support or instructed to
|
||||
/// disconnect from upon receipt.
|
||||
#[error("Remote peer sent an unsupported message type.")]
|
||||
UnsupportedMessage,
|
||||
/// We got a `Reject` message. This does not necessarily mean that
|
||||
/// the peer connection is in a bad state, but for the time being
|
||||
/// we are considering it a PeerError.
|
||||
|
|
|
@ -325,6 +325,18 @@ where
|
|||
_ => {}
|
||||
}
|
||||
|
||||
// Per BIP-011, since we don't advertise NODE_BLOOM, we MUST
|
||||
// disconnect from this peer immediately.
|
||||
match msg {
|
||||
Message::FilterLoad { .. }
|
||||
| Message::FilterAdd { .. }
|
||||
| Message::FilterClear { .. } => {
|
||||
self.fail_with(PeerError::UnsupportedMessage);
|
||||
return;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Interpret `msg` as a request from the remote peer to our node,
|
||||
// and try to construct an appropriate request object.
|
||||
let req = match msg {
|
||||
|
|
Loading…
Reference in New Issue