2017-07-29 81 views
1

,當我嘗試運行這個測試,在cordapp模板的流程:失敗/錯誤尚未啓動

@Test 
fun flowRecordTransactionInBothVaults() { 

    val flow = IOUFlow.Initiator(1,b.info.legalIdentity) 
    val future = a.services.startFlow(flow).resultFuture 
    net.runNetwork() 
    val signedTx = future.getOrThrow() 

    for (node in listOf(a,b)) { 
     assertEquals(signedTx, node.storage.validatedTransactions.getTransaction(signedTx.id)) 
    } 
} 

我得到這個錯誤:進度跟蹤器有沒有已開始

[INFO ] 15:14:52.144 [Mock network] AbstractNetworkMapService.processRegistrationRequest - Added node CN=Mock Company 3,O=R3,L=New York,C=US to network map 

[WARN ] 15:14:52.172 [Mock network] [a11087fc-381d-4547-8736-5265c334c71f].maybeWireUpProgressTracking - ProgressTracker has not been started 

[WARN ] 15:14:52.191 [Mock network] [0dcfa270-b1af-40e9-92f1-411334cf0c73].run - Terminated by unexpected exceptionkotlin.NotImplementedError: An operation is not implemented: not implemented 
at com.template.flow.IOUFlow$Acceptor$call$1.checkTransaction(TemplateFlow.kt:225) ~[main/:?] 

at net.corda.flows.SignTransactionFlow.call(CollectSignaturesFlow.kt:201) ~[corda-core-0.13.0.jar:?] 
at net.corda.flows.SignTransactionFlow.call(CollectSignaturesFlow.kt:177) ~[corda-core-0.13.0.jar:?] 

[WARN ] 15:14:52.202 [Mock network] [a11087fc-381d-4547-8736-5265c334c71f].run - Terminated by unexpected exceptionnet.corda.core.flows.FlowSessionException: Counterparty flow on CN=Mock Company 3,O=R3,L=New York,C=US had an internal error and has terminated 
at net.corda.node.services.statemachine.FlowStateMachineImpl.erroredEnd(FlowStateMachineImpl.kt:382) ~[corda-node 

[WARN ] 15:14:52.203 [Mock network] [a11087fc-381d-4547-8736-5265c334c71f].uncaughtException - Caught exception from flowjava.lang.IllegalStateException: Progress tracker has already ended 
at net.corda.core.utilities.ProgressTracker.endWithError 

其實代碼要長得多,但我認爲這些是相關的部分。這是一件已知的事情嗎?我該如何解決它?

+0

該模板的哪個版本/結帳正在運行? –

+0

build.gradle Corda版本設置爲0.13.0,但是,我敢肯定它來自git的主人,我已經使用克隆HTTPS功能克隆它,如果這不是您想要的,我該如何檢查正確的版本/結帳? –

+0

這是你自己的測試還是現有的測試?我無法在模板代碼庫中找到此測試。看起來你可能會使用SignTransactionFlow而不重寫checkTransaction? – joel

回答

1

實施SignTransactionFlow時,必須覆蓋checkTransactions

+0

我已經做到了,我必須重寫樂趣checkTransaction(STX:SignedTransaction){} 在我的代碼 ,但我不知道我shuold把裏面的教程說: SignTransactionFlow已經檢查交易的簽名以及交易是否合約有效。 SignTransactionFlow.checkTransaction的目的是在我們簽署之前定義我們希望執行的事務的任何附加驗證。例如,我們可能希望: 檢查交易是否包含IOUState 檢查IOU的值是否過高 –

+1

以下是cordapp-tutorial的一個示例:https://github.com/corda/cordapp-教程/斑點/主/科特林 - 源極/ SRC /主/科特林/ COM /示例/流量/ ExampleFlow.kt。 – joel