Skip to content

Commit

Permalink
fix: when queue is empty, no need build mint tx and clear tx.
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanYuan committed Aug 9, 2024
1 parent 371042a commit 242a682
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions branch-chain-aggregator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ impl Aggregator {
fn get_rgbpp_queue_requests(&self) -> Result<(Vec<Request>, OutPoint), Error> {
let (queue_cell, queue_cell_data) = self.get_rgbpp_queue_cell()?;
if queue_cell_data.outbox().is_empty() {
info!("No requests in queue");
return Ok((vec![], OutPoint::default()));
}
let request_ids: Vec<Byte32> = queue_cell_data.outbox().into_iter().collect();
Expand Down
7 changes: 6 additions & 1 deletion branch-chain-aggregator/src/transaction/clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@ use std::collections::HashMap;
impl Aggregator {
pub(crate) fn create_clear_queue_tx(
&self,
_rgbpp_queue_cells: Vec<Request>,
rgbpp_queue_cells: Vec<Request>,
_queue_cell: OutPoint,
) -> Result<H256, Error> {
if rgbpp_queue_cells.is_empty() {
info!("no queue requests to clear");
return Ok(H256::default());
}

// get queue cell
let (queue_cell, queue_cell_data) = self.get_rgbpp_queue_cell()?;

Expand Down
5 changes: 5 additions & 0 deletions branch-chain-aggregator/src/transaction/leap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ impl Aggregator {
requests: Vec<Request>,
queue_cell: OutPoint,
) -> Result<H256, Error> {
if requests.is_empty() {
info!("No requests to mint, skip leap tx");
return Ok(H256::default());
}

// Check if the requests of the last leap tx are duplicated, and if so, return immediately.
let witness = self.get_last_leap_tx_witness();
if let Ok((witness, tx_hash)) = witness {
Expand Down

0 comments on commit 242a682

Please sign in to comment.