pub struct DifficultyState {
pub block_difficulty: RwLock<[u8; 32]>,
pub transaction_difficulty: RwLock<[u8; 32]>,
pub last_timestamp: RwLock<u64>,
}Fields§
§block_difficulty: RwLock<[u8; 32]>§transaction_difficulty: RwLock<[u8; 32]>§last_timestamp: RwLock<u64>Implementations§
Source§impl DifficultyState
Manages network difficulty and TX POW difficulty
impl DifficultyState
Manages network difficulty and TX POW difficulty
Sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Create a new empty Difficulty State
Sourcepub fn update_difficulty(&self, new_block: &Block)
pub fn update_difficulty(&self, new_block: &Block)
Update the network difficulties after adding a new block to the blockchain
pub fn get_block_difficulty(&self) -> [u8; 32]
pub fn get_transaction_difficulty(&self) -> [u8; 32]
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for DifficultyState
impl<'__de, __Context> BorrowDecode<'__de, __Context> for DifficultyState
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Source§impl Clone for DifficultyState
impl Clone for DifficultyState
Source§impl Debug for DifficultyState
impl Debug for DifficultyState
Source§impl<__Context> Decode<__Context> for DifficultyState
impl<__Context> Decode<__Context> for DifficultyState
Auto Trait Implementations§
impl !Freeze for DifficultyState
impl RefUnwindSafe for DifficultyState
impl Send for DifficultyState
impl Sync for DifficultyState
impl Unpin for DifficultyState
impl UnwindSafe for DifficultyState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more