Skip to content

Commit

Permalink
Fix DbId issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jacek-casper committed Jan 10, 2024
1 parent bfa7ff7 commit 5f74a05
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions types/src/binary_port/db_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ use rand::Rng;
#[cfg(test)]
use crate::testing::TestRng;

const BLOCK_HEADER_DB_TAG: u8 = 0;
const BLOCK_METADATA_DB_TAG: u8 = 1;
const TRANSFER_DB_TAG: u8 = 2;
const STATE_STORE_DB_TAG: u8 = 3;
const BLOCK_BODY_DB_TAG: u8 = 4;
const FINALIZED_TRANSACTION_APPROVALS_DB_TAG: u8 = 5;
const APPROVALS_HASHES_DB_TAG: u8 = 6;
const TRANSACTION_DB_TAG: u8 = 7;
const EXECUTION_RESULT_DB_TAG: u8 = 8;

/// Allows to indicate to which database the binary request refers to.
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)]
#[repr(u8)]
Expand Down Expand Up @@ -107,18 +97,7 @@ impl ToBytes for DbId {
}

fn write_bytes(&self, writer: &mut Vec<u8>) -> Result<(), bytesrepr::Error> {
match self {
DbId::BlockHeader => BLOCK_HEADER_DB_TAG,
DbId::BlockMetadata => BLOCK_METADATA_DB_TAG,
DbId::Transfer => TRANSFER_DB_TAG,
DbId::StateStore => STATE_STORE_DB_TAG,
DbId::BlockBody => BLOCK_BODY_DB_TAG,
DbId::FinalizedTransactionApprovals => FINALIZED_TRANSACTION_APPROVALS_DB_TAG,
DbId::ApprovalsHashes => APPROVALS_HASHES_DB_TAG,
DbId::Transaction => TRANSACTION_DB_TAG,
DbId::ExecutionResult => EXECUTION_RESULT_DB_TAG,
}
.write_bytes(writer)
u8::from(*self).write_bytes(writer)
}

fn serialized_length(&self) -> usize {
Expand Down

0 comments on commit 5f74a05

Please sign in to comment.