Node/Watcher: Update solana min accounts check (#3367)

This commit is contained in:
bruce-riley 2023-09-11 10:55:06 -05:00 committed by GitHub
parent bd666ef076
commit 846deb2f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -158,11 +158,11 @@ func (c ConsistencyLevel) Commitment() (rpc.CommitmentType, error) {
}
const (
postMessageInstructionNumAccounts = 9
postMessageInstructionID = 0x01
postMessageUnreliableInstructionID = 0x08
accountPrefixReliable = "msg"
accountPrefixUnreliable = "msu"
postMessageInstructionMinNumAccounts = 8
postMessageInstructionID = 0x01
postMessageUnreliableInstructionID = 0x08
accountPrefixReliable = "msg"
accountPrefixUnreliable = "msu"
)
// PostMessageData represents the user-supplied, untrusted instruction data
@ -609,9 +609,9 @@ func (s *SolanaWatcher) processInstruction(ctx context.Context, logger *zap.Logg
return false, nil
}
if len(inst.Accounts) != postMessageInstructionNumAccounts {
return false, fmt.Errorf("invalid number of accounts: %d instead of %d",
len(inst.Accounts), postMessageInstructionNumAccounts)
if len(inst.Accounts) < postMessageInstructionMinNumAccounts {
return false, fmt.Errorf("invalid number of accounts: %d, must be at least %d",
len(inst.Accounts), postMessageInstructionMinNumAccounts)
}
// Decode instruction data (UNTRUSTED)