From 5fa6944a37c856413f84edca3aea2d8b8bf95062 Mon Sep 17 00:00:00 2001 From: cachalots Date: Fri, 27 Feb 2026 15:40:18 +0800 Subject: [PATCH] culimit --- pkg/shreder/tx.go | 2 +- pkg/shreder/txparser.go | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/pkg/shreder/tx.go b/pkg/shreder/tx.go index 7be3349..08fc560 100644 --- a/pkg/shreder/tx.go +++ b/pkg/shreder/tx.go @@ -45,7 +45,7 @@ type TxSignal struct { IsToken2022 bool `json:"is_token2022"` IsMayhemMode bool `json:"is_mayhem_mode"` CUPrice decimal.Decimal `json:"cu_price"` - CULimit decimal.Decimal `json:"cu_limit"` + CULimit uint32 `json:"cu_limit"` SWQoSAgent string `json:"swqos_agent"` SWQoSTips decimal.Decimal `json:"swqos_tips"` diff --git a/pkg/shreder/txparser.go b/pkg/shreder/txparser.go index 08016d4..3dbad1a 100644 --- a/pkg/shreder/txparser.go +++ b/pkg/shreder/txparser.go @@ -203,22 +203,19 @@ func ParseTransactionWithHandler(ctx context.Context, versioned VersionedTransac cuPrice := decimal.Zero swqosAgent := "" swqosTips := decimal.Zero - cuLimit := decimal.Zero + cuLimit := uint32(0) for _, instruction := range versioned.Instructions { program, err := versioned.GetAccount(int(instruction.ProgramIDIndex)) if err != nil { continue } - if program.Equals(ComputeBudgetProgram) && - len(instruction.Data) == 9 { - if instruction.Data[0] == 0x03 { + if program.Equals(ComputeBudgetProgram) { + if len(instruction.Data) == 9 && instruction.Data[0] == 0x03 { cuPriceUint64 := binary.LittleEndian.Uint64(instruction.Data[1:9]) cuPrice = formatCUPrice(cuPriceUint64) - } else if instruction.Data[0] == 0x02 { - cuLimitUint32 := binary.LittleEndian.Uint32(instruction.Data[1:4]) - cuLimit = formatCUPrice(uint64(cuLimitUint32)) + } else if len(instruction.Data) == 5 && instruction.Data[0] == 0x02 { + cuLimit = binary.LittleEndian.Uint32(instruction.Data[1:4]) } - } if program.Equals(solana.SystemProgramID) && len(instruction.Data) == 12 &&