Skip to content

Commit eda8c88

Browse files
committed
shell/abci: use u64 for block height
1 parent 3af5847 commit eda8c88

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

crates/node/src/shell/abci.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ enum CheckAction {
262262
/// No check necessary.
263263
NoAction,
264264
/// Check a given block height.
265-
Check(i64),
265+
Check(u64),
266266
/// The action been taken.
267267
AlreadySuspended,
268268
}
@@ -302,10 +302,8 @@ impl Service {
302302
mut shutdown_recv: broadcast::Receiver<()>,
303303
) -> (bool, Option<<Self as tower::Service<Request>>::Future>) {
304304
let hght = match check {
305-
CheckAction::AlreadySuspended => BlockHeight::from(u64::MAX),
306-
CheckAction::Check(hght) => BlockHeight::from(
307-
u64::try_from(hght).expect("Height cannot be negative"),
308-
),
305+
CheckAction::AlreadySuspended => BlockHeight(u64::MAX),
306+
CheckAction::Check(hght) => BlockHeight(hght),
309307
CheckAction::NoAction => BlockHeight::default(),
310308
};
311309
match action_at_height {
@@ -417,7 +415,7 @@ impl Service {
417415
fn get_action(&self, req: &Request) -> Option<CheckAction> {
418416
match req {
419417
Request::PrepareProposal(req) => {
420-
Some(CheckAction::Check(req.height.into())) // TODO switch to u64?
418+
Some(CheckAction::Check(req.height.into()))
421419
}
422420
Request::ProcessProposal(req) => {
423421
Some(CheckAction::Check(req.height.into()))

0 commit comments

Comments
 (0)