Skip to content

Commit c0c602e

Browse files
committed
Minor cleanup
1 parent 5ee6c5d commit c0c602e

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

src/node.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ impl Encodable for Node {
633633
}
634634
}
635635

636+
#[inline]
636637
pub fn encode_account_leaf(
637638
nonce_rlp: &ArrayVec<u8, 9>,
638639
balance_rlp: &ArrayVec<u8, 33>,
@@ -653,6 +654,7 @@ pub fn encode_account_leaf(
653654
len
654655
}
655656

657+
#[inline]
656658
pub fn encode_branch(children: &[Option<Pointer>], out: &mut dyn BufMut) -> usize {
657659
// first encode the header
658660
let mut payload_length = 1;

src/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl<DB: Deref<Target = Database>, K: TransactionKind> Transaction<DB, K> {
9292
self.database
9393
.storage_engine
9494
.compute_state_root_with_overlay_iterative(&self.context, overlay_state)
95-
.map_err(|_| TransactionError::Generic)
95+
.map_err(|_| TransactionError)
9696
}
9797

9898
pub fn get_account_with_proof(

src/transaction/error.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
use std::{error::Error, fmt};
22

33
#[derive(Debug)]
4-
pub enum TransactionError {
5-
/// Generic transaction error (for backward compatibility)
6-
Generic,
7-
/// Overlay functionality is not enabled for this transaction
8-
OverlayNotEnabled,
9-
}
4+
pub struct TransactionError;
105

116
impl fmt::Display for TransactionError {
127
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13-
match self {
14-
Self::Generic => write!(f, "transaction error"),
15-
Self::OverlayNotEnabled => {
16-
write!(f, "overlay functionality is not enabled for this transaction")
17-
}
18-
}
8+
write!(f, "transaction error")
199
}
2010
}
2111

src/transaction/manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl TransactionManager {
2525
pub fn begin_rw(&mut self, snapshot_id: SnapshotId) -> Result<SnapshotId, TransactionError> {
2626
// only allow one writable transaction at a time
2727
if self.has_writer {
28-
return Err(TransactionError::Generic);
28+
return Err(TransactionError);
2929
}
3030
self.has_writer = true;
3131
self.open_txs.push(snapshot_id - 1);

0 commit comments

Comments
 (0)