0

我正在玩fabcarHyperledger Fabric 中的示例。在那里,在链代码中,我将queryAllCars函数名称更改为queryAllProducts,然后在query.js正在使用的文件中更改了该方法名称。但由于不存在的功能,我收到以下错误。我通过 queryAllCars 函数用法的名称检查了所有地方,但无法找出问题所在。这个问题的根本原因是什么?

2019-06-23T04:14:37.101Z - warn: [Query]: evaluate: Query ID "[object Object]" of peer "peer0.ibo.bc4scm.de" failed: message=transaction returned with failure: Error: You've asked to invoke a function that does not exist: queryAllProducts, stack=Error: transaction returned with failure: Error: You've asked to invoke a function that does not exist: queryAllProducts
at self._endorserClient.processProposal (/home/malintha/Academic/3rd_Semester/DLT4PI/BCNetwork/BC4SCM/FrontEndCalls/node_modules/fabric-client/lib/Peer.js:140:36)
at Object.onReceiveStatus (/home/malintha/Academic/3rd_Semester/DLT4PI/BCNetwork/BC4SCM/FrontEndCalls/node_modules/grpc/src/client_interceptors.js:1207:9)
at InterceptingListener._callNext (/home/malintha/Academic/3rd_Semester/DLT4PI/BCNetwork/BC4SCM/FrontEndCalls/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/home/malintha/Academic/3rd_Semester/DLT4PI/BCNetwork/BC4SCM/FrontEndCalls/node_modules/grpc/src/client_interceptors.js:618:8)
at callback (/home/malintha/Academic/3rd_Semester/DLT4PI/BCNetwork/BC4SCM/FrontEndCalls/node_modules/grpc/src/client_interceptors.js:845:24), status=500, , url=grpc://localhost:7051, name=peer0.ibo.bc4scm.de, grpc.max_receive_message_length=-1, grpc.max_send_message_length=-1, grpc.keepalive_time_ms=120000, grpc.http2.min_time_between_pings_ms=120000, grpc.keepalive_timeout_ms=20000, grpc.http2.max_pings_without_data=0, grpc.keepalive_permit_without_calls=1, name=peer0.ibo.bc4scm.de, request-timeout=300000, isProposalResponse=true
Failed to evaluate transaction: Error: transaction returned with failure: Error: You've asked to invoke a function that does not exist: queryAllProducts
4

1 回答 1

1

每当您更改/编辑链代码时,您都必须再次安装并实例化它给对等方。我建议请使用新版本安装链代码,您可以在链代码安装部分的 startfabric.sh 脚本中找到该部分。它看起来像这样。

 peer chaincode install \
        -n fabcar \
        -v 1.0 \
        -p "$CC_SRC_PATH" \
    -l "$CC_RUNTIME_LANGUAGE"

为两个同行更改它。

或者您可以手动删除已安装在对等体中的旧链代码。

于 2019-06-24T07:04:39.893 回答