Serialize Amount to bytes using byteorder::LittleEndian
This commit is contained in:
parent
646b506e7a
commit
1255cec6a4
|
@ -1,6 +1,6 @@
|
|||
//! The LightClientRootHash enum, used for the corresponding block header field.
|
||||
|
||||
use crate::note_commitment_tree::SaplingNoteTreeRootHash;
|
||||
use crate::treestate::note_commitment_tree::SaplingNoteTreeRootHash;
|
||||
use crate::types::BlockHeight;
|
||||
use crate::{Network, NetworkUpgrade, NetworkUpgrade::*};
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ use std::{
|
|||
ops::RangeInclusive,
|
||||
};
|
||||
|
||||
use byteorder::{ByteOrder, LittleEndian};
|
||||
|
||||
type Result<T, E = Error> = std::result::Result<T, E>;
|
||||
|
||||
/// A runtime validated type for representing amounts of zatoshis
|
||||
|
@ -24,7 +26,9 @@ impl<C> Amount<C> {
|
|||
|
||||
/// To little endian byte array
|
||||
pub fn to_bytes(&self) -> [u8; 8] {
|
||||
self.0.to_le_bytes()
|
||||
let mut buf: [u8; 8] = [0; 8];
|
||||
LittleEndian::write_i64(&mut buf, self.0);
|
||||
buf
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue