Crate floresta_common

Source
Expand description

§Floresta Common

Provides utility functions, macros and modules to be used in other Floresta crates.

Re-exports§

pub use spsc::Channel;

Modules§

ema 🔒
macros
This module has useful macros for usage on other crates.
prelude
Provides implementation for basic std types, without assuming we have a std library.
service_flags
Utreexo-specific service flags.
spsc
A no-std Single Producer, Single Consumer channel for unidirectional message exchange between modules. This module don’t use anything from the standard lib and can be easily used in no-std environments. We only use mem::take from core.

Macros§

acchashes
Validates Utreexo node hashes at compile time. Requires BitcoinNodeHash to be in scope.
assert_err
Panic if the expression is not Err(_).
assert_ok
Panic if the expression is not Ok(_).
bhash
Validates a block hash at compile time. Requires BlockHash to be in scope.
impl_error_from
Implements the From trait for converting a specific type into an enum variant or struct field.

Structs§

Ema
Exponential moving average (EMA) over scalar samples.

Functions§

get_hash_from_u8
Computes the SHA-256 digest of the byte slice data and returns a Hash from bitcoin_hashes.
get_spk_hash
Computes the SHA-256 digest of a script, reverses its bytes, and returns a Hash from bitcoin_hashes.
parse_descriptors
Takes an array of descriptors as String, performs sanity checks on each one and returns list of parsed descriptors.
read_bounded_len
Reads a VarInt from the given reader and ensures it is less than or equal to max.