-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.0' into python-serialization
- Loading branch information
Showing
18 changed files
with
2,987 additions
and
2,468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
// Copyright 2020-2021 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::types::block::{payload::signed_transaction::TransactionId, rand::bytes::rand_bytes_array}; | ||
use crate::types::block::{ | ||
payload::signed_transaction::{TransactionHash, TransactionId}, | ||
rand::{bytes::rand_bytes_array, number::rand_number}, | ||
slot::SlotIndex, | ||
}; | ||
|
||
/// Generates a random transaction id with a given slot index. | ||
pub fn rand_transaction_id_with_slot_index(slot_index: impl Into<SlotIndex>) -> TransactionId { | ||
TransactionHash::new(rand_bytes_array()).into_transaction_id(slot_index.into()) | ||
} | ||
|
||
/// Generates a random transaction id. | ||
pub fn rand_transaction_id() -> TransactionId { | ||
TransactionId::new(rand_bytes_array()) | ||
rand_transaction_id_with_slot_index(rand_number::<u32>()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.