Fix a bug in ContractUpgradeFlowTest where it wasn't actually checking both nodes.

This commit is contained in:
Mike Hearn 2017-02-18 16:08:56 +00:00
parent 006faa82a1
commit 036b2597d3

View File

@ -79,18 +79,24 @@ class ContractUpgradeFlowTest {
val result = resultFuture.get()
listOf(a, b).forEach {
val stx = databaseTransaction(a.database) { a.services.storageService.validatedTransactions.getTransaction(result.ref.txhash) }
requireNotNull(stx)
fun check(node: MockNetwork.MockNode) {
val nodeStx = databaseTransaction(node.database) {
node.services.storageService.validatedTransactions.getTransaction(result.ref.txhash)
}
requireNotNull(nodeStx)
// Verify inputs.
val input = databaseTransaction(a.database) { a.services.storageService.validatedTransactions.getTransaction(stx!!.tx.inputs.single().txhash) }
val input = databaseTransaction(node.database) {
node.services.storageService.validatedTransactions.getTransaction(nodeStx!!.tx.inputs.single().txhash)
}
requireNotNull(input)
assertTrue(input!!.tx.outputs.single().data is DummyContract.State)
// Verify outputs.
assertTrue(stx!!.tx.outputs.single().data is DummyContractV2.State)
assertTrue(nodeStx!!.tx.outputs.single().data is DummyContractV2.State)
}
check(a)
check(b)
}
@Test