如何在Hyperledger结构上提交事务时修复“错误:没有收到成功事件”?

问题描述 投票:0回答:1

我在https://developer.ibm.com/tutorials/ibm-blockchain-platform-vscode-smart-contract/上关注教程,当我通过IBM区块链平台VS代码扩展提交事务时,我得到错误:

“提交交易时出错:未收到成功事件”。

调用的函数是'instantiate',如下所示:

    public async instantiate(ctx: Context): Promise<any> {
        const greeting = { text: 'Instantiate was called!' };
        await ctx.stub.putState('GREETING', Buffer.from(JSON.stringify(greeting)));
    }

即使抛出错误,运行此命令也会成功写入分类帐。之后我能够查询分类帐并看到正确的值“{text:'实例化被调用!' }“被退回了。

这是我运行instantiate的单元测试时的错误跟踪。希望能帮助到你:

     Error: No successful events received
      at AllForTxStrategy.checkCompletion (node_modules/fabric-network/lib/impl/event/allfortxstrategy.js:34:12)
      at AllForTxStrategy.errorReceived (node_modules/fabric-network/lib/impl/event/abstracteventstrategy.js:67:8)
      at TransactionEventHandler._onError (node_modules/fabric-network/lib/impl/event/transactioneventhandler.js:126:17)
      at EventRegistration.eventHub.registerTxEvent [as _onErrorFn] (node_modules/fabric-network/lib/impl/event/transactioneventhandler.js:90:20)
      at EventRegistration.onError (node_modules/fabric-network/node_modules/fabric-client/lib/ChannelEventHub.js:1709:9)
      at ChannelEventHub._closeAllCallbacks (node_modules/fabric-network/node_modules/fabric-client/lib/ChannelEventHub.js:867:15)
      at ChannelEventHub._disconnect (node_modules/fabric-network/node_modules/fabric-client/lib/ChannelEventHub.js:625:8)
      at ClientDuplexStream._stream.on (node_modules/fabric-network/node_modules/fabric-client/lib/ChannelEventHub.js:539:11)
      at addChunk (_stream_readable.js:283:12)
      at readableAddChunk (_stream_readable.js:264:11)
      at ClientDuplexStream.Readable.push (_stream_readable.js:219:10)
      at Object.onReceiveMessage (node_modules/fabric-network/node_modules/grpc/src/client_interceptors.js:1292:19)
      at InterceptingListener.recvMessageWithContext (node_modules/fabric-network/node_modules/grpc/src/client_interceptors.js:607:19)
      at /Users/chana/projects/ibm-bp/node_modules/fabric-network/node_modules/grpc/src/client_interceptors.js:706:14
hyperledger-fabric ibm-blockchain ibp-vscode-extension
1个回答
1
投票

在我提交交易后,我注意到VS Code中的local fabric输出存在差异:

[4/13/2019 9:41:22 PM] [INFO] fabricvscodelocalfabric_peer0.org1.example.com | 2019-04-12 12:17:55.210 UTC [common.deliver] deliverBlocks - > WARN 05a拒绝交付172.19。 0.1:34608由于包络验证错误:包络时间戳2019-04-13 11:41:22.439 +0000 UTC与当前服务器时间相差超过15m0s 2019-04-12 12:17:55.210409997 +0000 UTC m = + 169.648611001

这看起来像peer0上的某种时间差异所以我进入其bash并运行date以查看不正确的服务器时间(2019-04-12 12:17:55),然后我尝试更正服务器时间。

在此之后,我重新尝试了Submit Transaction,它没有抛出错误!

我试图通过拆除结构然后重新启动来再次复制原始问题,但提交事务似乎现在按预期工作。

© www.soinside.com 2019 - 2024. All rights reserved.