Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Rpc: filters performance improvement #20185

Merged
merged 14 commits into from
Oct 14, 2021
Prev Previous commit
Next Next commit
Fix clippy for deprecated
  • Loading branch information
fanatid committed Sep 25, 2021
commit 750634e627083b73a0d0374d4ff561bafa63023b
14 changes: 5 additions & 9 deletions client/src/rpc_filter.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use std::borrow::Cow;
use thiserror::Error;

Expand All @@ -19,7 +20,6 @@ impl RpcFilterType {
use MemcmpEncodedBytes::*;
const FILTER_LIMIT: usize = 128;
match &compare.bytes {
#[allow(deprecated)]
Binary(bytes) | Base58(bytes) if bytes.len() > FILTER_LIMIT => {
Err(RpcFilterError::Base58DataTooLarge)
}
Expand All @@ -32,13 +32,10 @@ impl RpcFilterType {
_ => Ok(()),
}?;
match &compare.bytes {
#[allow(deprecated)]
Binary(bytes) => {
bs58::decode(&bytes).into_vec().map(|_| ()).map_err(|e| {
#[allow(deprecated)]
RpcFilterError::DecodeError(e)
})
}
Binary(bytes) => bs58::decode(&bytes)
.into_vec()
.map(|_| ())
.map_err(RpcFilterError::DecodeError),
Base58(bytes) => bs58::decode(&bytes)
.into_vec()
.map(|_| ())
Expand Down Expand Up @@ -106,7 +103,6 @@ impl Memcmp {
pub fn bytes(&self) -> Option<Cow<Vec<u8>>> {
use MemcmpEncodedBytes::*;
match &self.bytes {
#[allow(deprecated)]
Binary(bytes) | Base58(bytes) => bs58::decode(bytes).into_vec().ok().map(Cow::Owned),
Base64(bytes) => base64::decode(bytes).ok().map(Cow::Owned),
Bytes(bytes) => Some(Cow::Borrowed(bytes)),
Expand Down