3 Commits

Author SHA1 Message Date
cachalots
c7be7cf4fd culimit 2026-02-27 16:45:57 +08:00
cachalots
62c313d4a1 culimit 2026-02-27 15:41:20 +08:00
cachalots
5fa6944a37 culimit 2026-02-27 15:40:18 +08:00
2 changed files with 10 additions and 10 deletions

View File

@@ -45,9 +45,10 @@ 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 decimal.Decimal `json:"cu_limit"` 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"`
TableCnt int `json:"table_cnt"`
ExactSOL bool `json:"exact_in"` ExactSOL bool `json:"exact_in"`

View File

@@ -182,7 +182,8 @@ func ParseTransactionForEntries(ctx context.Context, slot uint64, entriesReader
} }
func ParseTransactionWithHandler(ctx context.Context, versioned VersionedTransaction, loader *AddressTables, parsed chan<- TxSignal, handlers map[solana.PublicKey]Handler) { func ParseTransactionWithHandler(ctx context.Context, versioned VersionedTransaction, loader *AddressTables, parsed chan<- TxSignal, handlers map[solana.PublicKey]Handler) {
if loader != nil && len(versioned.AddressTableLookups) > 0 { tableCnt := len(versioned.AddressTableLookups)
if loader != nil && tableCnt > 0 {
lookupTableOk := true lookupTableOk := true
for _, lookups := range versioned.AddressTableLookups { for _, lookups := range versioned.AddressTableLookups {
lookupTableOk = loader.FillToTx(&versioned, lookups.AccountKey, lookups.WritableIndexes) lookupTableOk = loader.FillToTx(&versioned, lookups.AccountKey, lookups.WritableIndexes)
@@ -203,22 +204,19 @@ func ParseTransactionWithHandler(ctx context.Context, versioned VersionedTransac
cuPrice := decimal.Zero cuPrice := decimal.Zero
swqosAgent := "" swqosAgent := ""
swqosTips := decimal.Zero swqosTips := decimal.Zero
cuLimit := 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 {
if 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 instruction.Data[0] == 0x02 { } else if len(instruction.Data) == 5 && instruction.Data[0] == 0x02 {
cuLimitUint32 := binary.LittleEndian.Uint32(instruction.Data[1:4]) cuLimit = binary.LittleEndian.Uint32(instruction.Data[1:5])
cuLimit = formatCUPrice(uint64(cuLimitUint32))
} }
} }
if program.Equals(solana.SystemProgramID) && if program.Equals(solana.SystemProgramID) &&
len(instruction.Data) == 12 && len(instruction.Data) == 12 &&
@@ -269,6 +267,7 @@ func ParseTransactionWithHandler(ctx context.Context, versioned VersionedTransac
one.CULimit = cuLimit one.CULimit = cuLimit
one.SWQoSAgent = swqosAgent one.SWQoSAgent = swqosAgent
one.SWQoSTips = swqosTips one.SWQoSTips = swqosTips
one.TableCnt = tableCnt
select { select {
case <-ctx.Done(): case <-ctx.Done():
return return