Skip to content

Commit 23b8648

Browse files
committed
Refactors extraction of block proposer
1 parent 8d1a70f commit 23b8648

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

chain/src/main.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,7 @@ async fn crawling_fn(
286286
namada_service::query_native_addresses_balance_change(Token::Native(
287287
native_token.clone(),
288288
));
289-
let addresses = block.addresses_with_balance_change(
290-
&native_token,
291-
block
292-
.header
293-
.proposer_address_namada
294-
.as_ref()
295-
.map(|address| Id::Account(address.clone())),
296-
);
289+
let addresses = block.addresses_with_balance_change(&native_token);
297290

298291
let token_supplies = first_block_in_epoch
299292
.eq(&block_height)

shared/src/block.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,6 @@ impl Block {
687687
pub fn addresses_with_balance_change(
688688
&self,
689689
native_token: &Id,
690-
block_proposer: Option<Id>,
691690
) -> HashSet<BalanceChange> {
692691
self.transactions
693692
.iter()
@@ -712,10 +711,12 @@ impl Block {
712711
// If the token is not the native one also push the balanche
713712
// change of the block proposer (the balance change for the
714713
// native token is pushed by default)
715-
if let Some(block_proposer) = &block_proposer {
716-
if &wrapper_tx.fee.gas_token != native_token {
714+
if &wrapper_tx.fee.gas_token != native_token {
715+
if let Some(block_proposer) =
716+
&self.header.proposer_address_namada
717+
{
717718
balance_changes.push(BalanceChange::new(
718-
block_proposer.to_owned(),
719+
Id::Account(block_proposer.to_owned()),
719720
Token::Native(wrapper_tx.fee.gas_token.clone()),
720721
));
721722
}

0 commit comments

Comments
 (0)