Skip to content

Commit

Permalink
Merge pull request #4647 from eval-exec/exec/do-not-contains-cell-bas…
Browse files Browse the repository at this point in the history
…e-in-get_fee_rate_statistics

`get_fee_rate_statistics` should skip first (cellbase) Transaction
  • Loading branch information
quake committed Sep 13, 2024
2 parents b314c85 + 1a15a68 commit cbdc43a
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 cbdc43a

Please sign in to comment.