2018-01-03 21:19:09 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Importing useful functions for cc testing
|
|
|
|
if [ -f ./func.sh ]; then
|
|
|
|
source ./func.sh
|
|
|
|
elif [ -f scripts/func.sh ]; then
|
|
|
|
source scripts/func.sh
|
|
|
|
fi
|
|
|
|
|
2018-01-14 19:49:20 +08:00
|
|
|
CC_NAME=${CC_02_NAME}
|
|
|
|
CC_PATH=${CC_02_PATH}
|
|
|
|
CC_UPGRADE_ARGS=${CC_02_UPGRADE_ARGS}
|
2018-01-03 21:19:09 +08:00
|
|
|
#Upgrade to new version
|
2018-01-14 19:49:20 +08:00
|
|
|
echo_b "Upgrade chaincode ${CC_NAME} to new version..."
|
|
|
|
chaincodeInstall 1 0 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
|
|
|
|
chaincodeInstall 1 1 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
|
|
|
|
chaincodeInstall 2 0 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
|
|
|
|
chaincodeInstall 2 1 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_PATH}"
|
2018-01-03 21:19:09 +08:00
|
|
|
|
|
|
|
# Upgrade on one peer of the channel will update all
|
2018-01-14 19:49:20 +08:00
|
|
|
chaincodeUpgrade ${APP_CHANNEL} 1 0 "${CC_NAME}" "${CC_UPGRADE_VERSION}" "${CC_UPGRADE_ARGS}"
|
2018-01-03 21:19:09 +08:00
|
|
|
|
|
|
|
# Query new value, should refresh through all peers in the channel
|
2018-01-14 19:49:20 +08:00
|
|
|
chaincodeQuery ${APP_CHANNEL} 1 0 "${CC_NAME}" "${CC_QUERY_ARGS}" 100
|
|
|
|
chaincodeQuery ${APP_CHANNEL} 2 1 "${CC_NAME}" "${CC_QUERY_ARGS}" 100
|
2018-01-03 21:19:09 +08:00
|
|
|
|
|
|
|
echo_g "=== All GOOD, chaincode Upgrade completed ==="
|