keeper: fix tx size limits on charge collateral fee batching
This commit is contained in:
parent
d9f55c4c22
commit
54674e4b20
|
@ -552,7 +552,12 @@ async fn send_batched_log_errors_no_confirm(
|
||||||
current_batch.append(ixs.clone());
|
current_batch.append(ixs.clone());
|
||||||
|
|
||||||
tx_builder.instructions = current_batch.clone().to_instructions();
|
tx_builder.instructions = current_batch.clone().to_instructions();
|
||||||
if !tx_builder.transaction_size().is_ok() || current_batch.cu > max_cu {
|
if tx_builder
|
||||||
|
.transaction_size()
|
||||||
|
.map(|ts| !ts.is_within_limit())
|
||||||
|
.unwrap_or(true)
|
||||||
|
|| current_batch.cu > max_cu
|
||||||
|
{
|
||||||
tx_builder.instructions = previous_batch.to_instructions();
|
tx_builder.instructions = previous_batch.to_instructions();
|
||||||
match tx_builder.send(client).await {
|
match tx_builder.send(client).await {
|
||||||
Err(err) => error!("could not send transaction: {err:?}"),
|
Err(err) => error!("could not send transaction: {err:?}"),
|
||||||
|
|
|
@ -92,7 +92,7 @@ impl<'a> LiquidateHelper<'a> {
|
||||||
let exceeds_cu_limit = new_ixs.cu > self.config.max_cu_per_transaction;
|
let exceeds_cu_limit = new_ixs.cu > self.config.max_cu_per_transaction;
|
||||||
let exceeds_size_limit = {
|
let exceeds_size_limit = {
|
||||||
tx_builder.instructions = new_ixs.clone().to_instructions();
|
tx_builder.instructions = new_ixs.clone().to_instructions();
|
||||||
!tx_builder.transaction_size()?.is_ok()
|
!tx_builder.transaction_size()?.is_within_limit()
|
||||||
};
|
};
|
||||||
if exceeds_cu_limit || exceeds_size_limit {
|
if exceeds_cu_limit || exceeds_size_limit {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -231,7 +231,7 @@ impl Rebalancer {
|
||||||
.prepare_swap_transaction(full)
|
.prepare_swap_transaction(full)
|
||||||
.await?;
|
.await?;
|
||||||
let tx_size = builder.transaction_size()?;
|
let tx_size = builder.transaction_size()?;
|
||||||
if tx_size.is_ok() {
|
if tx_size.is_within_limit() {
|
||||||
return Ok((builder, full.clone()));
|
return Ok((builder, full.clone()));
|
||||||
}
|
}
|
||||||
trace!(
|
trace!(
|
||||||
|
|
|
@ -2233,7 +2233,7 @@ pub struct TransactionSize {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TransactionSize {
|
impl TransactionSize {
|
||||||
pub fn is_ok(&self) -> bool {
|
pub fn is_within_limit(&self) -> bool {
|
||||||
let limit = Self::limit();
|
let limit = Self::limit();
|
||||||
self.length <= limit.length && self.accounts <= limit.accounts
|
self.length <= limit.length && self.accounts <= limit.accounts
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue