Support multiple msps
parent
cbe0f0010e
commit
4a5e597408
|
@ -201,34 +201,40 @@ genUpdateTx() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sign a channel update transaction
|
# Sign a channel update transaction
|
||||||
# Usage: signUpdateTx mspId mspPath tx
|
# Usage: signUpdateTx update_tx mspId mspPath
|
||||||
signUpdateTx() {
|
signUpdateTx() {
|
||||||
if [ $# -lt 3 ]; then
|
if [ $# -lt 3 ]; then
|
||||||
echo "Not enough argument supplied"
|
echo "Not enough argument supplied, at least need 3"
|
||||||
echo "$(basename $0) mspId mspPath tx"
|
echo "$(basename $0) udpate_tx mspId mspPath..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mspId=$1
|
tx=$1; shift
|
||||||
mspPath=$2
|
|
||||||
tx=$3
|
|
||||||
|
|
||||||
echo "Sign channel config tx $tx by $mspId"
|
for((i=1;i<=$#;)); do
|
||||||
[ -f "${tx}" ] || {
|
mspId=${!i}
|
||||||
echo "${tx} not exist"
|
((i++))
|
||||||
exit 1
|
mspPath=${!i}
|
||||||
}
|
((i++))
|
||||||
|
|
||||||
export CORE_PEER_LOCALMSPID=${mspId}
|
echo "Sign channel config tx $tx by $mspId $mspPath"
|
||||||
export CORE_PEER_MSPCONFIGPATH=${mspPath}
|
[ -f "${tx}" ] || {
|
||||||
|
echo "${tx} not exist"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
peer channel signconfigtx -f "${tx}" >log.txt 2>&1
|
export CORE_PEER_LOCALMSPID=${mspId}
|
||||||
rc=$?
|
export CORE_PEER_MSPCONFIGPATH=${mspPath}
|
||||||
[ $rc -ne 0 ] && cat log.txt
|
|
||||||
if [ $rc -ne 0 ]; then
|
peer channel signconfigtx -f "${tx}" >log.txt 2>&1
|
||||||
echo "Sign channel config tx $tx by $mspId failed"
|
rc=$?
|
||||||
else
|
[ $rc -ne 0 ] && cat log.txt
|
||||||
echo "Sign channel config tx $tx by $mspId is successful"
|
if [ $rc -ne 0 ]; then
|
||||||
fi
|
echo "Sign channel config tx $tx by $mspId failed"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
echo "Sign channel config tx $tx by $mspId is successful"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -269,11 +275,11 @@ sendUpdateTx() {
|
||||||
|
|
||||||
# Entrance function, will call other functions
|
# Entrance function, will call other functions
|
||||||
# Update a single channel's config, need to be founder's admin
|
# Update a single channel's config, need to be founder's admin
|
||||||
# Usage: updateChannel channel, ordererURL, mspId, mspPath
|
# Usage: updateChannel channel, ordererURL, mspId, mspPath, (mspId2, mspPath2...)
|
||||||
UpdateChannel() {
|
UpdateChannel() {
|
||||||
if [ $# -lt 3 ]; then
|
if [ $# -lt 3 ]; then
|
||||||
echo "Not enough argument supplied"
|
echo "Not enough argument supplied"
|
||||||
echo "$(basename $0) channel ordererURL mspId mspPath=${PWD}/msp-mspId"
|
echo "$(basename $0) channel ordererURL mspId mspPath=${PWD}/msp-mspId msp1 mspPath1 msp2 mspPath2..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
channel=$1
|
channel=$1
|
||||||
|
@ -300,7 +306,7 @@ UpdateChannel() {
|
||||||
|
|
||||||
# TODO: do we support multiple msps?
|
# TODO: do we support multiple msps?
|
||||||
echo "[${channel}] Sign the channel update tx ${updateTx} by $mspId $mspPath"
|
echo "[${channel}] Sign the channel update tx ${updateTx} by $mspId $mspPath"
|
||||||
signUpdateTx "${mspId}" "${mspPath}" "${updateTx}"
|
signUpdateTx "${updateTx}" "${mspId}" "${mspPath}" "${otherMSPs}"
|
||||||
[ $? -ne 0 ] && { echo "[${channel}] Failed to sign the channel config update tx" && exit 1; }
|
[ $? -ne 0 ] && { echo "[${channel}] Failed to sign the channel config update tx" && exit 1; }
|
||||||
|
|
||||||
echo "[${channel}] Send the channel update tx ${updateTx} by $mspId $mspPath to ${ordererTLSRoot}"
|
echo "[${channel}] Send the channel update tx ${updateTx} by $mspId $mspPath to ${ordererTLSRoot}"
|
||||||
|
@ -309,14 +315,12 @@ UpdateChannel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -lt 4 ]; then
|
if [ $# -lt 4 ]; then
|
||||||
echo "Not enough argument supplied"
|
echo "Not enough argument supplied, at least 4"
|
||||||
echo "$(basename $0) channelListFile ordererURL mspId mspPath"
|
echo "$(basename $0) channelListFile ordererURL orderer-mspId orderer-mspPath other-mspId other-mspPath..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
channelListFile=$1
|
channelListFile=$1
|
||||||
ordererURL=$2
|
|
||||||
mspId=$3
|
|
||||||
mspPath=$4 # the msp path
|
|
||||||
|
|
||||||
if [ -f ${channelListFile} ]; then
|
if [ -f ${channelListFile} ]; then
|
||||||
i=0
|
i=0
|
||||||
|
|
Loading…
Reference in New Issue