mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 03:38:35 +00:00
transaction: don't overwrite error and witnesses length check
ReadArray() can return some error and we shouldn't overwrite it. At the same time limiting ReadArray() to the number of Signers can make it return wrong error if the number of witnesses actually is bigger than the number of signers, so use MaxAttributes.
This commit is contained in:
parent
d487b54612
commit
d2732a71d8
1 changed files with 2 additions and 2 deletions
|
@ -148,8 +148,8 @@ func (t *Transaction) decodeBinaryNoSize(br *io.BinReader) {
|
|||
if br.Err != nil {
|
||||
return
|
||||
}
|
||||
br.ReadArray(&t.Scripts, len(t.Signers))
|
||||
if len(t.Signers) != len(t.Scripts) {
|
||||
br.ReadArray(&t.Scripts, MaxAttributes)
|
||||
if br.Err == nil && len(t.Signers) != len(t.Scripts) {
|
||||
br.Err = fmt.Errorf("%w: %d vs %d", ErrInvalidWitnessNum, len(t.Signers), len(t.Scripts))
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue