Skip to content

Commit

Permalink
FeeRateCollector::statistics should skip first cellbase value
Browse files Browse the repository at this point in the history
Signed-off-by: Eval EXEC <execvy@gmail.com>
  • Loading branch information
eval-exec committed Sep 13, 2024
1 parent b314c85 commit 1a15a68
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rpc/src/util/fee_rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,19 @@ where
target = std::cmp::min(self.provider.max_target(), target);

let mut fee_rates = self.provider.collect(target, |mut fee_rates, block_ext| {
if !block_ext.txs_fees.is_empty()
if block_ext.txs_fees.len() > 1
&& block_ext.cycles.is_some()
&& block_ext.txs_sizes.is_some()
{
// block_ext.txs_fees, cycles, txs_sizes length is same
for (fee, cycles, size) in itertools::izip!(
block_ext.txs_fees,
block_ext.cycles.expect("checked"),
block_ext.txs_sizes.expect("checked")
) {
)
// skip cellbase (first element in the Vec)
.skip(1)
{
let weight = get_transaction_weight(size as usize, cycles);
if weight > 0 {
fee_rates.push(FeeRate::calculate(fee, weight).as_u64());
Expand Down

0 comments on commit 1a15a68

Please sign in to comment.