Skip to content

Commit

Permalink
fix(katana-rpc): only include successful transactions in pending block (
Browse files Browse the repository at this point in the history
#2082)

Only include successful transactions in pending block
  • Loading branch information
kariy authored Jun 19, 2024
1 parent fc44c36 commit 4db8ae0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/katana/rpc/rpc/src/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,16 @@ impl<EF: ExecutorFactory> StarknetApiServer for StarknetApi<EF> {
sequencer_address: block_env.sequencer_address,
};

// TODO(kariy): create a method that can perform this filtering for us instead
// of doing it manually.

// A block should only include successful transactions, we filter out the failed
// ones (didn't pass validation stage).
let transactions = executor
.read()
.transactions()
.iter()
.filter(|(_, receipt)| receipt.is_success())
.map(|(tx, _)| tx.hash)
.collect::<Vec<_>>();

Expand Down Expand Up @@ -307,10 +313,16 @@ impl<EF: ExecutorFactory> StarknetApiServer for StarknetApi<EF> {
sequencer_address: block_env.sequencer_address,
};

// TODO(kariy): create a method that can perform this filtering for us instead
// of doing it manually.

// A block should only include successful transactions, we filter out the failed
// ones (didn't pass validation stage).
let transactions = executor
.read()
.transactions()
.iter()
.filter(|(_, receipt)| receipt.is_success())
.map(|(tx, _)| tx.clone())
.collect::<Vec<_>>();

Expand Down

0 comments on commit 4db8ae0

Please sign in to comment.