Merge pull request #3455 from nspcc-dev/sast

Adjust minor SAST warnings
This commit is contained in:
Anna Shaleva 2024-06-05 12:21:42 +03:00 committed by GitHub
commit 3c471f0b7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -3017,12 +3017,7 @@ func (bc *Blockchain) verifyTxWitnesses(t *transaction.Transaction, block *block
// verifyHeaderWitnesses is a block-specific implementation of VerifyWitnesses logic.
func (bc *Blockchain) verifyHeaderWitnesses(currHeader, prevHeader *block.Header) error {
var hash util.Uint160
if prevHeader == nil && currHeader.PrevHash.Equals(util.Uint256{}) {
hash = currHeader.Script.ScriptHash()
} else {
hash = prevHeader.NextConsensus
}
hash := prevHeader.NextConsensus
_, err := bc.VerifyWitness(hash, currHeader, &currHeader.Script, HeaderVerificationGasLimit)
return err
}

View file

@ -157,6 +157,11 @@ func (o *Oracle) processRequest(priv *keys.PrivateKey, req request) error {
resp.Code = transaction.Error
}
case neofs.URIScheme:
if len(o.MainCfg.NeoFS.Nodes) == 0 {
o.Log.Warn("no NeoFS nodes configured", zap.String("url", req.Req.URL))
resp.Code = transaction.Error
break
}
ctx, cancel := context.WithTimeout(context.Background(), o.MainCfg.NeoFS.Timeout)
defer cancel()
index := (int(req.ID) + incTx.attempts) % len(o.MainCfg.NeoFS.Nodes)