Document state after call to calculate_root_inline
The function call `calculate_root_inline` calculates the merkle root using the input array as a scratch buffer, i.e., we trash the data during recursive calls to `merkle_root_r`. Add explicit documentation to the function so its super clear not to use the hashes again after calling this function.
This commit is contained in:
parent
2dbc7fdf21
commit
29df410ea3
|
@ -26,7 +26,9 @@ use crate::consensus::encode::Encodable;
|
||||||
|
|
||||||
/// Calculates the merkle root of a list of *hashes*, inline (in place) in `hashes`.
|
/// Calculates the merkle root of a list of *hashes*, inline (in place) in `hashes`.
|
||||||
///
|
///
|
||||||
/// In most cases, you'll want to use [`calculate_root`] instead.
|
/// In most cases, you'll want to use [`calculate_root`] instead. Please note, calling this function
|
||||||
|
/// trashes the data in `hashes` (i.e. the `hashes` is left in an undefined state at conclusion of
|
||||||
|
/// this method and should not be used again afterwards).
|
||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
/// - `None` if `hashes` is empty. The merkle root of an empty tree of hashes is undefined.
|
/// - `None` if `hashes` is empty. The merkle root of an empty tree of hashes is undefined.
|
||||||
|
|
Loading…
Reference in New Issue