Skip to content

Commit

Permalink
geyser: allow to set custom filter size in the config (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid authored Feb 20, 2024
1 parent ce9f054 commit c895c64
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The minor version will be incremented upon a breaking change and the patch versi
### Fixes

- deps: make cargo-deny happy about openssl, unsafe-libyaml, h2, ahash ([#278](https://github.com/rpcpool/yellowstone-grpc/pull/278))
- geyser: allow to set custom filter size in the config ([#288](https://github.com/rpcpool/yellowstone-grpc/pull/288))

### Features

Expand Down
10 changes: 10 additions & 0 deletions yellowstone-grpc-geyser/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ pub struct ConfigGrpc {
pub address: SocketAddr,
/// TLS config
pub tls_config: Option<ConfigGrpcServerTls>,
/// Limits the maximum size of a decoded message, default is 4MiB
#[serde(
default = "ConfigGrpc::max_decoding_message_size_default",
deserialize_with = "deserialize_usize_str"
)]
pub max_decoding_message_size: usize,
/// Capacity of the channel used for accounts from snapshot,
/// on reaching the limit Sender block validator startup.
#[serde(
Expand Down Expand Up @@ -98,6 +104,10 @@ pub struct ConfigGrpc {
}

impl ConfigGrpc {
const fn max_decoding_message_size_default() -> usize {
4 * 1024 * 1024
}

const fn snapshot_plugin_channel_capacity_default() -> Option<usize> {
None
}
Expand Down
4 changes: 3 additions & 1 deletion yellowstone-grpc-geyser/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ impl GrpcService {
}

// Create Server
let max_decoding_message_size = config.max_decoding_message_size;
let service = GeyserServer::new(Self {
config,
blocks_meta,
Expand All @@ -753,7 +754,8 @@ impl GrpcService {
broadcast_tx: broadcast_tx.clone(),
})
.accept_compressed(CompressionEncoding::Gzip)
.send_compressed(CompressionEncoding::Gzip);
.send_compressed(CompressionEncoding::Gzip)
.max_decoding_message_size(max_decoding_message_size);

// Run geyser message loop
let (messages_tx, messages_rx) = mpsc::unbounded_channel();
Expand Down

0 comments on commit c895c64

Please sign in to comment.