transaction: add missing alloc in state decoder

Fixes panic two lines below:
panic: runtime error: index out of range [recovered]
        panic: runtime error: index out of range
This commit is contained in:
Roman Khimov 2019-08-30 19:34:26 +03:00
parent 203aab6a7e
commit b8adc36e6a

View file

@ -18,6 +18,7 @@ func (tx *StateTX) DecodeBinary(r io.Reader) error {
if br.Err != nil { if br.Err != nil {
return br.Err return br.Err
} }
tx.Descriptors = make([]*StateDescriptor, lenDesc)
for i := 0; i < int(lenDesc); i++ { for i := 0; i < int(lenDesc); i++ {
tx.Descriptors[i] = &StateDescriptor{} tx.Descriptors[i] = &StateDescriptor{}
if err := tx.Descriptors[i].DecodeBinary(r); err != nil { if err := tx.Descriptors[i].DecodeBinary(r); err != nil {