Skip to content

Commit

Permalink
fix: use static instead of const for interior-mutable type
Browse files Browse the repository at this point in the history
  • Loading branch information
Evalir committed Sep 20, 2023
1 parent 56f6bb2 commit 6044a1e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/mev-share-rpc-api/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use hyper::Body;

use tower::{Layer, Service};

const FLASHBOTS_HEADER: HeaderName = HeaderName::from_static("x-flashbots-signature");
static FLASHBOTS_HEADER: HeaderName = HeaderName::from_static("x-flashbots-signature");

/// Layer that applies [`FlashbotsSigner`] which adds a request header with a signed payload.
#[derive(Clone)]
Expand Down Expand Up @@ -83,7 +83,7 @@ where
.get(http::header::CONTENT_TYPE)
.map(|v| v == HeaderValue::from_static("application/json"))
.unwrap_or(false);
let has_sig = parts.headers.contains_key(FLASHBOTS_HEADER);
let has_sig = parts.headers.contains_key(FLASHBOTS_HEADER.clone());

if !is_json || has_sig {
return Box::pin(async move {
Expand All @@ -104,7 +104,7 @@ where
let header_val =
HeaderValue::from_str(&format!("{:?}:0x{}", signer.address(), signature))
.expect("Header contains invalid characters");
parts.headers.insert(FLASHBOTS_HEADER, header_val);
parts.headers.insert(FLASHBOTS_HEADER.clone(), header_val);

let request = Request::from_parts(parts, Body::from(body_bytes.clone()));
inner.call(request).await.map_err(Into::into)
Expand Down

0 comments on commit 6044a1e

Please sign in to comment.