complete match for has_context_bytes

This commit is contained in:
realbigsean 2023-02-13 16:44:54 -05:00
parent fc2d07b4e3
commit ad9af6d8b1
No known key found for this signature in database
GPG Key ID: BE1B3DB104F6C788
4 changed files with 28 additions and 17 deletions

View File

@ -32,7 +32,15 @@ fn get_store(db_path: &TempDir) -> Arc<HotColdDB> {
let cold_path = db_path.path().join("cold_db");
let config = StoreConfig::default();
let log = NullLoggerBuilder.build().expect("logger should build");
HotColdDB::open(&hot_path, &cold_path,None, |_, _, _| Ok(()), config, spec, log)
HotColdDB::open(
&hot_path,
&cold_path,
None,
|_, _, _| Ok(()),
config,
spec,
log,
)
.expect("disk store should initialize")
}

View File

@ -60,7 +60,15 @@ fn get_store_with_spec(
let config = StoreConfig::default();
let log = test_logger();
HotColdDB::open(&hot_path, &cold_path, None, |_, _, _| Ok(()), config, spec, log)
HotColdDB::open(
&hot_path,
&cold_path,
None,
|_, _, _| Ok(()),
config,
spec,
log,
)
.expect("disk store should initialize")
}

View File

@ -41,14 +41,12 @@ use tokio::{
};
use tokio_stream::wrappers::WatchStream;
use types::consts::eip4844::BLOB_TX_TYPE;
use types::transaction::{AccessTuple, BlobTransaction, EcdsaSignature, SignedBlobTransaction};
use types::{
blobs_sidecar::{Blobs, KzgCommitments},
ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadEip4844, ExecutionPayloadMerge,
};
use types::transaction::{AccessTuple, BlobTransaction, EcdsaSignature, SignedBlobTransaction};
use types::{
AbstractExecPayload, BeaconStateError, ExecPayload, VersionedHash,
};
use types::{AbstractExecPayload, BeaconStateError, ExecPayload, VersionedHash};
use types::{
BlindedPayload, BlockType, ChainSpec, Epoch, ExecutionBlockHash, ForkName,
ProposerPreparationData, PublicKeyBytes, Signature, SignedBeaconBlock, Slot, Transaction,

View File

@ -408,15 +408,12 @@ impl ProtocolId {
/// Returns `true` if the given `ProtocolId` should expect `context_bytes` in the
/// beginning of the stream, else returns `false`.
pub fn has_context_bytes(&self) -> bool {
match self.version {
Version::V2 => matches!(
self.message_name,
Protocol::BlocksByRange | Protocol::BlocksByRoot
),
Version::V1 => matches!(
self.message_name,
Protocol::BlobsByRange | Protocol::BlobsByRoot
),
match self.message_name {
Protocol::BlocksByRange | Protocol::BlocksByRoot => {
!matches!(self.version, Version::V1)
}
Protocol::BlobsByRange | Protocol::BlobsByRoot | Protocol::LightClientBootstrap => true,
Protocol::Goodbye | Protocol::Ping | Protocol::Status | Protocol::MetaData => false,
}
}
}