pub struct EconomicParameters {
pub initial_subsidy: u64,
pub halving_interval: u64,
pub max_money_supply: u64,
pub coinbase_maturity: u64,
pub dust_limit: u64,
pub min_fee_rate: u64,
pub max_fee_rate: u64,
pub min_relay_fee: u64,
pub subsidy_schedule: Vec<(u64, u64)>,
}Expand description
Economic model parameters for a protocol version
Fields§
§initial_subsidy: u64Initial block subsidy (in satoshis)
halving_interval: u64Block subsidy halving interval
max_money_supply: u64Maximum money supply (in satoshis)
coinbase_maturity: u64Coinbase maturity (blocks before coinbase can be spent)
dust_limit: u64Dust limit (minimum output value in satoshis)
min_fee_rate: u64Minimum transaction fee rate (satoshis per vbyte)
max_fee_rate: u64Maximum transaction fee rate (satoshis per vbyte)
min_relay_fee: u64Minimum relay fee (satoshis per vbyte)
subsidy_schedule: Vec<(u64, u64)>Block subsidy schedule (for custom schedules)
Implementations§
Source§impl EconomicParameters
impl EconomicParameters
Sourcepub fn for_protocol(version: ProtocolVersion) -> Self
pub fn for_protocol(version: ProtocolVersion) -> Self
Get economic parameters for a protocol version
Sourcepub fn get_block_subsidy(&self, height: u64) -> u64
pub fn get_block_subsidy(&self, height: u64) -> u64
Calculate block subsidy for a given height
Sourcepub fn total_supply_at_height(&self, height: u64) -> u64
pub fn total_supply_at_height(&self, height: u64) -> u64
Calculate total supply up to a given height
Sourcepub fn is_valid_fee_rate(&self, fee_rate: u64) -> bool
pub fn is_valid_fee_rate(&self, fee_rate: u64) -> bool
Check if a fee rate is valid
Sourcepub fn calculate_fee(
&self,
size_vbytes: usize,
fee_rate_sat_per_vbyte: u64,
) -> u64
pub fn calculate_fee( &self, size_vbytes: usize, fee_rate_sat_per_vbyte: u64, ) -> u64
Calculate fee for a transaction size
Sourcepub fn exceeds_max_supply(&self, height: u64) -> bool
pub fn exceeds_max_supply(&self, height: u64) -> bool
Check if total supply exceeds maximum
Trait Implementations§
Source§impl Clone for EconomicParameters
impl Clone for EconomicParameters
Source§fn clone(&self) -> EconomicParameters
fn clone(&self) -> EconomicParameters
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EconomicParameters
impl Debug for EconomicParameters
Source§impl<'de> Deserialize<'de> for EconomicParameters
impl<'de> Deserialize<'de> for EconomicParameters
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for EconomicParameters
impl PartialEq for EconomicParameters
Source§fn eq(&self, other: &EconomicParameters) -> bool
fn eq(&self, other: &EconomicParameters) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for EconomicParameters
impl Serialize for EconomicParameters
impl Eq for EconomicParameters
impl StructuralPartialEq for EconomicParameters
Auto Trait Implementations§
impl Freeze for EconomicParameters
impl RefUnwindSafe for EconomicParameters
impl Send for EconomicParameters
impl Sync for EconomicParameters
impl Unpin for EconomicParameters
impl UnsafeUnpin for EconomicParameters
impl UnwindSafe for EconomicParameters
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more