Skip to content

Commit f0dddc3

Browse files
committed
feat: check before doing counter if allocation is not running rav request
1 parent 8b865b7 commit f0dddc3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

tap-agent/src/agent/sender_account.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,11 @@ impl Actor for SenderAccount {
640640
.sender_fee_tracker
641641
.get_total_counter_outside_buffer_for_allocation(&allocation_id)
642642
as u64;
643-
let counter_greater_receipt_limit =
644-
total_counter_for_allocation >= state.config.tap.rav_request_receipt_limit;
643+
let counter_greater_receipt_limit = total_counter_for_allocation
644+
>= state.config.tap.rav_request_receipt_limit
645+
&& !state
646+
.sender_fee_tracker
647+
.check_allocation_has_rav_request_running(allocation_id);
645648
let total_fee_outside_buffer =
646649
state.sender_fee_tracker.get_total_fee_outside_buffer();
647650
let total_fee_greater_trigger_value =

tap-agent/src/agent/sender_fee_tracker.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ impl SenderFeeTracker {
237237
pub fn ok_rav_request(&mut self, allocation_id: Address) {
238238
self.failed_ravs.remove(&allocation_id);
239239
}
240+
241+
pub fn check_allocation_has_rav_request_running(&self, allocation_id: Address) -> bool {
242+
self.ids_requesting.contains(&allocation_id)
243+
}
240244
}
241245

242246
#[cfg(test)]

0 commit comments

Comments
 (0)