[−][src]Struct ckb_reward_calculator::RewardCalculator
Fields
consensus: &'a Consensus
store: &'a CS
Implementations
impl<'a, CS: ChainStore<'a>> RewardCalculator<'a, CS>
[src]
pub fn new(consensus: &'a Consensus, store: &'a CS) -> Self
[src]
pub fn block_reward_to_finalize(
&self,
parent: &HeaderView
) -> Result<(Script, BlockReward), Error>
[src]
&self,
parent: &HeaderView
) -> Result<(Script, BlockReward), Error>
RewardCalculator
is used to calculate block finalize target's reward according to the parent header.
block reward consists of four parts: base block reward, tx fee, proposal reward, and secondary block reward.
pub fn block_reward_for_target(
&self,
target: &HeaderView
) -> Result<(Script, BlockReward), Error>
[src]
&self,
target: &HeaderView
) -> Result<(Script, BlockReward), Error>
pub fn txs_fees(&self, target: &HeaderView) -> Result<Capacity, Error>
[src]
Miner get (tx_fee - 40% of tx fee) for tx commitment. Be careful of the rounding, tx_fee - 40% of tx fee is different from 60% of tx fee.
pub fn proposal_reward(
&self,
parent: &HeaderView,
target: &HeaderView
) -> Result<Capacity, Error>
[src]
&self,
parent: &HeaderView,
target: &HeaderView
) -> Result<Capacity, Error>
Earliest proposer get 40% of tx fee as reward when tx committed block H(19) target H(13) ProposalWindow(2, 5) target current / / 10 11 12 13 14 15 16 17 18 19 \ \ \ _///__/ \ \ _/// \ _// _______/
Auto Trait Implementations
impl<'a, CS> RefUnwindSafe for RewardCalculator<'a, CS> where
CS: RefUnwindSafe,
CS: RefUnwindSafe,
impl<'a, CS> Send for RewardCalculator<'a, CS> where
CS: Sync,
CS: Sync,
impl<'a, CS> Sync for RewardCalculator<'a, CS> where
CS: Sync,
CS: Sync,
impl<'a, CS> Unpin for RewardCalculator<'a, CS>
impl<'a, CS> UnwindSafe for RewardCalculator<'a, CS> where
CS: RefUnwindSafe,
CS: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsAny for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,