Skip to content

Commit

Permalink
Fix default timestamp
Browse files Browse the repository at this point in the history
Signed-off-by: deniallugo <[email protected]>
  • Loading branch information
Deniallugo committed Sep 2, 2022
1 parent f50491d commit 1c23f6e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
5 changes: 2 additions & 3 deletions core/lib/types/src/tx/change_pubkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,8 @@ impl ChangePubKey {
out.extend_from_slice(&self.fee_token.to_be_bytes());
out.extend_from_slice(&pack_fee_amount(&self.fee));
out.extend_from_slice(&self.nonce.to_be_bytes());
if let Some(time_range) = &self.time_range {
out.extend_from_slice(&time_range.as_be_bytes());
}
let time_range = self.time_range.unwrap_or_default();
out.extend_from_slice(&time_range.as_be_bytes());
out
}

Expand Down
2 changes: 1 addition & 1 deletion core/lib/types/src/tx/primitives/time_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Default for TimeRange {
fn default() -> Self {
Self {
valid_from: 0,
valid_until: u64::max_value(),
valid_until: u64::MAX,
}
}
}
5 changes: 2 additions & 3 deletions core/lib/types/src/tx/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ impl Transfer {
out.extend_from_slice(&pack_token_amount(&self.amount));
out.extend_from_slice(&pack_fee_amount(&self.fee));
out.extend_from_slice(&self.nonce.to_be_bytes());
if let Some(time_range) = &self.time_range {
out.extend_from_slice(&time_range.as_be_bytes());
}
let time_range = self.time_range.unwrap_or_default();
out.extend_from_slice(&time_range.as_be_bytes());
out
}

Expand Down
5 changes: 2 additions & 3 deletions core/lib/types/src/tx/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,8 @@ impl Withdraw {
out.extend_from_slice(&self.amount.to_u128().unwrap().to_be_bytes());
out.extend_from_slice(&pack_fee_amount(&self.fee));
out.extend_from_slice(&self.nonce.to_be_bytes());
if let Some(time_range) = &self.time_range {
out.extend_from_slice(&time_range.as_be_bytes());
}
let time_range = self.time_range.unwrap_or_default();
out.extend_from_slice(&time_range.as_be_bytes());
out
}

Expand Down

0 comments on commit 1c23f6e

Please sign in to comment.