[#955] chainbase: Fix rule chain unmarshalling

* Use correct way DecodeBytes instead unmarshalling by json.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-02-02 20:26:14 +03:00
parent befbaf9d56
commit c1a5b831b6

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)