mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-21 17:15:10 +00:00
[FAB-12587] Fix for Query Block by block hash API
Block Query by hash Fixed in balance transfer app. Change-Id: Iad5c0af657e7359ee787e1f939a6695d470da1cd Signed-off-by: sebastianpaulp <spaul@jeadigital.com>
This commit is contained in:
parent
df311ce23a
commit
6dc5ce503b
2 changed files with 17 additions and 18 deletions
|
|
@ -115,7 +115,7 @@ var getBlockByHash = async function(peer, channelName, hash, username, org_name)
|
||||||
throw new Error(message);
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
let response_payload = await channel.queryBlockByHash(Buffer.from(hash), peer);
|
let response_payload = await channel.queryBlockByHash(Buffer.from(hash,'hex'), peer);
|
||||||
if (response_payload) {
|
if (response_payload) {
|
||||||
logger.debug(response_payload);
|
logger.debug(response_payload);
|
||||||
return response_payload;
|
return response_payload;
|
||||||
|
|
|
||||||
|
|
@ -209,11 +209,13 @@ echo
|
||||||
|
|
||||||
echo "GET query Block by blockNumber"
|
echo "GET query Block by blockNumber"
|
||||||
echo
|
echo
|
||||||
curl -s -X GET \
|
BLOCK_INFO=$(curl -s -X GET \
|
||||||
"http://localhost:4000/channels/mychannel/blocks/1?peer=peer0.org1.example.com" \
|
"http://localhost:4000/channels/mychannel/blocks/1?peer=peer0.org1.example.com" \
|
||||||
-H "authorization: Bearer $ORG1_TOKEN" \
|
-H "authorization: Bearer $ORG1_TOKEN" \
|
||||||
-H "content-type: application/json"
|
-H "content-type: application/json")
|
||||||
echo
|
echo $BLOCK_INFO
|
||||||
|
# Assign previvious block hash to HASH
|
||||||
|
HASH=$(echo $BLOCK_INFO | jq -r ".header.previous_hash")
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo "GET query Transaction by TransactionID"
|
echo "GET query Transaction by TransactionID"
|
||||||
|
|
@ -224,20 +226,17 @@ curl -s -X GET http://localhost:4000/channels/mychannel/transactions/$TRX_ID?pee
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
|
|
||||||
############################################################################
|
|
||||||
### TODO: What to pass to fetch the Block information
|
echo "GET query Block by Hash - Hash is $HASH"
|
||||||
############################################################################
|
echo
|
||||||
#echo "GET query Block by Hash"
|
curl -s -X GET \
|
||||||
#echo
|
"http://localhost:4000/channels/mychannel/blocks?hash=$HASH&peer=peer0.org1.example.com" \
|
||||||
#hash=????
|
-H "authorization: Bearer $ORG1_TOKEN" \
|
||||||
#curl -s -X GET \
|
-H "cache-control: no-cache" \
|
||||||
# "http://localhost:4000/channels/mychannel/blocks?hash=$hash&peer=peer1" \
|
-H "content-type: application/json" \
|
||||||
# -H "authorization: Bearer $ORG1_TOKEN" \
|
-H "x-access-token: $ORG1_TOKEN"
|
||||||
# -H "cache-control: no-cache" \
|
echo
|
||||||
# -H "content-type: application/json" \
|
echo
|
||||||
# -H "x-access-token: $ORG1_TOKEN"
|
|
||||||
#echo
|
|
||||||
#echo
|
|
||||||
|
|
||||||
echo "GET query ChainInfo"
|
echo "GET query ChainInfo"
|
||||||
echo
|
echo
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue