@@ -8,10 +8,10 @@ package enclave_go
88
99import (
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
1717const 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 {
7474func (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