最近写了一个Hyperledger Fabric区块监控的程序,功能是应用程序监听区块生成事件,并查询新生成区块的信息。然而,当客户端收到Peer发来的blockEvent事件后,调用Channel对象的queryBlockByNumber()方法时,出现了“error Entry not found in index”错误。
一、错误描述
在调用queryBlockByNumber()方法时,向peer发送一个proposal,调用fabric的系统链码qscc,从下面的错误描述看出,由于链码执行出现错误,因此报了代码为500的错。
[2019/04/01 10:21:35.429] [pool-15-thread-1] [Sending proposal to peer1.crossborder.unionpayintl.com failed because of: gRPC failure=Status{code=UNKNOWN, description=chaincode error (status: 500, message: Failed to get block number 36566, error Entry not found in index), cause=null}]
java.lang.Exception: io.grpc.StatusRuntimeException: UNKNOWN: chaincode error (status: 500, message: Failed to get block number 36566, error Entry not found in index)
at org.hyperledger.fabric.sdk.Channel.sendProposalToPeers(Channel.java:2241)
at org.hyperledger.fabric.sdk.Channel.sendProposal(Channel.java:2155)
at org.hyperledger.fabric.sdk.Channel.queryBlockByNumber(Channel.java:1680)
at org.hyperledger.fabric.sdk.Channel.queryBlockByNumber(Channel.java:1586)
at com.cup.blocklistener.hyperfabric.FabricServiceImpl.lambda$reconstructChannel$0(FabricServiceImpl.java:65)
at org.hyperledger.fabric.sdk.Channel.lambda$null$0(Channel.java:2612)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: io.grpc.StatusRuntimeException: UNKNOWN: chaincode error (status: 50