Skip to content

Commit f6c2ef5

Browse files
committed
fix: resolves comments
Signed-off-by: chenchanglew <lewchenchang@gmail.com>
1 parent b99495f commit f6c2ef5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ecc_go/chaincode/enclave_go/skvs_stub_interface.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ package enclave_go
88

99
import (
1010
"encoding/json"
11+
"fmt"
1112

1213
"github.com/hyperledger/fabric-chaincode-go/shim"
1314
pb "github.com/hyperledger/fabric-protos-go/peer"
14-
"github.com/pkg/errors"
1515
)
1616

1717
const SKVSKey = "SKVS"
@@ -27,13 +27,13 @@ func NewSkvsStubInterface(stub shim.ChaincodeStubInterface, input *pb.ChaincodeI
2727
fpcStub := NewFpcStubInterface(stub, input, rwset, sep)
2828
skvsStub := &SkvsStubInterface{
2929
FpcStubInterface: fpcStub,
30-
allDataOld: map[string][]byte{},
31-
allDataNew: map[string][]byte{},
30+
allDataOld: make(map[string][]byte),
31+
allDataNew: make(map[string][]byte),
3232
key: SKVSKey,
3333
}
3434
err := skvsStub.initSKVS()
3535
if err != nil {
36-
panic("Initializing SKVS failed")
36+
panic(fmt.Sprintf("Initializing SKVS failed, err: %v", err))
3737
}
3838
return skvsStub
3939
}
@@ -74,7 +74,8 @@ func (s *SkvsStubInterface) initSKVS() error {
7474
func (s *SkvsStubInterface) GetState(key string) ([]byte, error) {
7575
value, found := s.allDataOld[key]
7676
if !found {
77-
return nil, errors.New("skvs allDataOld key not found")
77+
logger.Errorf("skvs allDataOld key: %s, not found", key)
78+
return nil, nil
7879
}
7980
return value, nil
8081
}

0 commit comments

Comments
 (0)