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

View file

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