2 Commits

Author SHA1 Message Date
cachalots
5fa6944a37 culimit 2026-02-27 15:40:18 +08:00
cachalots
5d06d18aa8 culimit 2026-02-27 15:32:36 +08:00
2 changed files with 10 additions and 5 deletions

View File

@@ -45,6 +45,7 @@ type TxSignal struct {
IsToken2022 bool `json:"is_token2022"` IsToken2022 bool `json:"is_token2022"`
IsMayhemMode bool `json:"is_mayhem_mode"` IsMayhemMode bool `json:"is_mayhem_mode"`
CUPrice decimal.Decimal `json:"cu_price"` CUPrice decimal.Decimal `json:"cu_price"`
CULimit uint32 `json:"cu_limit"`
SWQoSAgent string `json:"swqos_agent"` SWQoSAgent string `json:"swqos_agent"`
SWQoSTips decimal.Decimal `json:"swqos_tips"` SWQoSTips decimal.Decimal `json:"swqos_tips"`

View File

@@ -203,16 +203,19 @@ func ParseTransactionWithHandler(ctx context.Context, versioned VersionedTransac
cuPrice := decimal.Zero cuPrice := decimal.Zero
swqosAgent := "" swqosAgent := ""
swqosTips := decimal.Zero swqosTips := decimal.Zero
cuLimit := uint32(0)
for _, instruction := range versioned.Instructions { for _, instruction := range versioned.Instructions {
program, err := versioned.GetAccount(int(instruction.ProgramIDIndex)) program, err := versioned.GetAccount(int(instruction.ProgramIDIndex))
if err != nil { if err != nil {
continue continue
} }
if program.Equals(ComputeBudgetProgram) && if program.Equals(ComputeBudgetProgram) {
len(instruction.Data) == 9 && if len(instruction.Data) == 9 && instruction.Data[0] == 0x03 {
instruction.Data[0] == 0x03 {
cuPriceUint64 := binary.LittleEndian.Uint64(instruction.Data[1:9]) cuPriceUint64 := binary.LittleEndian.Uint64(instruction.Data[1:9])
cuPrice = formatCUPrice(cuPriceUint64) cuPrice = formatCUPrice(cuPriceUint64)
} else if len(instruction.Data) == 5 && instruction.Data[0] == 0x02 {
cuLimit = binary.LittleEndian.Uint32(instruction.Data[1:4])
}
} }
if program.Equals(solana.SystemProgramID) && if program.Equals(solana.SystemProgramID) &&
len(instruction.Data) == 12 && len(instruction.Data) == 12 &&
@@ -260,6 +263,7 @@ func ParseTransactionWithHandler(ctx context.Context, versioned VersionedTransac
one.Label = handler.Label one.Label = handler.Label
one.Block = versioned.Block one.Block = versioned.Block
one.CUPrice = cuPrice one.CUPrice = cuPrice
one.CULimit = cuLimit
one.SWQoSAgent = swqosAgent one.SWQoSAgent = swqosAgent
one.SWQoSTips = swqosTips one.SWQoSTips = swqosTips
select { select {