Skip to content

Commit

Permalink
include pending utxos in get_utxos (#1154)
Browse files Browse the repository at this point in the history
  • Loading branch information
eyusufatik authored Sep 10, 2024
1 parent 9c88bed commit f06a37e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 0 additions & 2 deletions bin/citrea/tests/e2e/syncing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,6 @@ async fn test_healthcheck() {
let full_node_addr = full_node_port_rx.await.unwrap();
let full_node_test_client = make_test_client(full_node_addr).await.unwrap();

wait_for_l2_block(&full_node_test_client, 2, None).await;

let status = full_node_test_client.healthcheck().await.unwrap();
assert_eq!(status, 200);

Expand Down
2 changes: 1 addition & 1 deletion crates/bitcoin-da/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl BitcoinService {
async fn get_utxos(&self) -> Result<Vec<UTXO>, anyhow::Error> {
let utxos = self
.client
.list_unspent(None, None, None, None, None)
.list_unspent(Some(0), None, None, None, None)
.await?;
if utxos.is_empty() {
return Err(anyhow::anyhow!("There are no UTXOs"));
Expand Down
9 changes: 4 additions & 5 deletions crates/sequencer/src/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,10 @@ where
info!("Resubmitting pending commitments");

let pending_db_commitments = self.ledger_db.get_pending_commitments_l2_range()?;
debug!("Pending db commitments: {:?}", pending_db_commitments);
info!("Pending db commitments: {:?}", pending_db_commitments);

let pending_mempool_commitments = self.get_pending_mempool_commitments().await;
debug!(
info!(
"Commitments that are already in DA mempool: {:?}",
pending_mempool_commitments
);
Expand All @@ -619,7 +619,7 @@ where
let mined_commitments = self
.get_mined_commitments_from(last_commitment_l1_height)
.await?;
debug!(
info!(
"Commitments that are already mined by DA: {:?}",
mined_commitments
);
Expand All @@ -628,7 +628,6 @@ where
pending_commitments_to_remove.extend(pending_mempool_commitments);
pending_commitments_to_remove.extend(mined_commitments);

// TODO: also take mined DA blocks into account
for (l2_start, l2_end) in pending_db_commitments {
if pending_commitments_to_remove.iter().any(|commitment| {
commitment.l2_start_block_number == l2_start.0
Expand All @@ -642,7 +641,7 @@ where
}
};

// Delete from pending db if it is already in DA mempool
// Delete from pending db if it is already in DA mempool or mined
self.ledger_db
.delete_pending_commitment_l2_range(&(l2_start, l2_end))?;
} else {
Expand Down

0 comments on commit f06a37e

Please sign in to comment.