Skip to content

Commit 2875d37

Browse files
committed
chore(node): cast timestamp to u64 to satisfy clippy
1 parent c15015a commit 2875d37

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

data_structures/src/transaction_factory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ pub fn calculate_weight(
480480
pub fn get_utxos_balance(
481481
all_utxos: &UnspentOutputsPool,
482482
pkh: PublicKeyHash,
483-
now: i64,
483+
now: u64,
484484
) -> NodeBalance2 {
485485
let mut locked = 0u64;
486486
let mut unlocked = 0u64;
@@ -489,7 +489,7 @@ pub fn get_utxos_balance(
489489
|_| {},
490490
|x| {
491491
let vto = &x.1 .0;
492-
if vto.time_lock as i64 <= now {
492+
if vto.time_lock <= now {
493493
unlocked += vto.value;
494494
} else {
495495
locked += vto.value;

node/src/actors/chain_manager/handlers.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,6 +1798,7 @@ impl Handler<GetDataRequestInfo> for ChainManager {
17981798
}
17991799
}
18001800

1801+
#[allow(clippy::cast_sign_loss)]
18011802
impl Handler<GetBalance2> for ChainManager {
18021803
type Result = Result<NodeBalance2, failure::Error>;
18031804

@@ -1808,7 +1809,7 @@ impl Handler<GetBalance2> for ChainManager {
18081809
}
18091810
.into());
18101811
}
1811-
let now = get_timestamp();
1812+
let now = get_timestamp() as u64;
18121813
let balance = match msg {
18131814
GetBalance2::All(limits) => {
18141815
let mut balances: HashMap<PublicKeyHash, NodeBalance2> = HashMap::new();
@@ -1820,7 +1821,7 @@ impl Handler<GetBalance2> for ChainManager {
18201821
staked: 0,
18211822
unlocked: 0,
18221823
})
1823-
.add_utxo_value(vto.value, vto.time_lock as i64 > now);
1824+
.add_utxo_value(vto.value, vto.time_lock > now);
18241825
}
18251826
let stakes = self.chain_state.stakes.query_stakes(QueryStakesKey::All);
18261827
if let Ok(stakes) = stakes {

0 commit comments

Comments
 (0)