chainbase: Fix rule chain unmarshalling #955

Merged
fyrchik merged 1 commit from aarifullin/frostfs-node:fix/chainbase_chain_decoding into master 2024-02-02 17:49:59 +00:00
Showing only changes of commit c1a5b831b6 - Show all commits

View file

@ -2,7 +2,6 @@ package chainbase
import (
"context"
"encoding/json"
"errors"
"fmt"
"path/filepath"
@ -203,7 +202,7 @@ func (cs *boltLocalOverrideStorage) GetOverride(name chain.Name, target policyen
}
c := &chain.Chain{}
if err := json.Unmarshal(serializedChain, c); err != nil {
if err := c.DecodeBytes(serializedChain); err != nil {
return nil, err
}
return c, nil
@ -241,7 +240,7 @@ func (cs *boltLocalOverrideStorage) ListOverrides(name chain.Name, target policy
chains := make([]*chain.Chain, 0, len(serializedChains))
for _, serializedChain = range serializedChains {
c := &chain.Chain{}
if err := json.Unmarshal(serializedChain, c); err != nil {
if err := c.DecodeBytes(serializedChain); err != nil {
return nil, err
}
chains = append(chains, c)