split program source file

This commit is contained in:
thloyi
2026-01-28 14:11:34 +08:00
parent 35c5c83f4b
commit be86c888eb
29 changed files with 2792 additions and 2234 deletions

View File

@@ -17,6 +17,8 @@ type TableInfo struct {
addresses []solana.PublicKey
}
const MaxOverErrCount = 10
type AddressTables struct {
showTableLoaded bool
@@ -96,7 +98,7 @@ func (at *AddressTables) load(tablePubkey solana.PublicKey) {
})
}
func (at *AddressTables) FillToTx(tx *versionedTransaction, tablePubkey solana.PublicKey, idx []uint8) bool {
func (at *AddressTables) FillToTx(tx *VersionedTransaction, tablePubkey solana.PublicKey, idx []uint8) bool {
addresses, ok := at.tables.Get(tablePubkey)
if !ok {
at.load(tablePubkey)
@@ -112,7 +114,7 @@ func (at *AddressTables) FillToTx(tx *versionedTransaction, tablePubkey solana.P
}
return false
}
tx.Message.StaticAccountKeys = append(tx.Message.StaticAccountKeys, addresses.addresses[i])
tx.StaticAccountKeys = append(tx.StaticAccountKeys, addresses.addresses[i])
}
return true
}
@@ -129,7 +131,7 @@ func (at *AddressTables) GetAddressTable(tablePubkey solana.PublicKey, idx []uin
if int(i) >= len(addresses.addresses) {
logger.Error("over loadAddressTable failed", "idx", i, "table", tablePubkey)
addresses.overErrCount++
if addresses.overErrCount > 10 {
if addresses.overErrCount > MaxOverErrCount {
at.load(tablePubkey)
}
break