Skip to content

Commit

Permalink
version
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Nosov committed Apr 15, 2024
1 parent 5be29ca commit 1ed57cb
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions service/peer/cc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"

"github.com/hyperledger/fabric-protos-go/peer"

"github.com/s7techlab/hlf-sdk-go/service/ccpackage"
)

type (
Expand All @@ -25,29 +27,29 @@ type (
}
)

//func LifecycleVersionMatch(version LifecycleVersion, fabricVersion chaincode.FabricVersion) bool {
// switch version {
// case LifecycleVersion_LIFECYCLE_V1:
// switch fabricVersion {
// case chaincode.FabricVersion_FABRIC_V2_LIFECYCLE:
// return false
// case chaincode.FabricVersion_FABRIC_V1:
// fallthrough
// case chaincode.FabricVersion_FABRIC_V2:
// return true
// }
//
// case LifecycleVersion_LIFECYCLE_V2:
// switch fabricVersion {
//
// case chaincode.FabricVersion_FABRIC_V2_LIFECYCLE:
// return true
// case chaincode.FabricVersion_FABRIC_V1:
// fallthrough
// case chaincode.FabricVersion_FABRIC_V2:
// return false
// }
// }
//
// return false
//}
func LifecycleVersionMatch(version LifecycleVersion, fabricVersion ccpackage.FabricVersion) bool {
switch version {
case LifecycleVersion_LIFECYCLE_V1:
switch fabricVersion {
case ccpackage.FabricVersion_FABRIC_V2_LIFECYCLE:
return false
case ccpackage.FabricVersion_FABRIC_V1:
fallthrough
case ccpackage.FabricVersion_FABRIC_V2:
return true
}

case LifecycleVersion_LIFECYCLE_V2:
switch fabricVersion {

case ccpackage.FabricVersion_FABRIC_V2_LIFECYCLE:
return true
case ccpackage.FabricVersion_FABRIC_V1:
fallthrough
case ccpackage.FabricVersion_FABRIC_V2:
return false
}
}

return false
}

0 comments on commit 1ed57cb

Please sign in to comment.