From e449ba93c48a01a612efb9b21d1568152c11f390 Mon Sep 17 00:00:00 2001 From: Jose Coll Date: Tue, 1 Nov 2016 16:29:21 +0000 Subject: [PATCH] Minor fix following rebase to incoporate Ross changes to CashState definition. --- .../com/r3corda/contracts/asset/CashTests.kt | 53 +------------------ .../node/services/vault/NodeVaultService.kt | 2 +- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/contracts/src/test/kotlin/com/r3corda/contracts/asset/CashTests.kt b/contracts/src/test/kotlin/com/r3corda/contracts/asset/CashTests.kt index 3d3c9af3b1..ab1b31efb1 100644 --- a/contracts/src/test/kotlin/com/r3corda/contracts/asset/CashTests.kt +++ b/contracts/src/test/kotlin/com/r3corda/contracts/asset/CashTests.kt @@ -85,57 +85,6 @@ class CashTests { } } - @After - fun tearDown() { - LogHelper.reset(NodeVaultService::class) - dataSource.close() - } - - lateinit var services: MockServices - val vault: VaultService get() = services.vaultService - lateinit var dataSource: Closeable - lateinit var database: Database - lateinit var vaultService: Vault - - @Before - fun setUp() { - LogHelper.setLevel(NodeVaultService::class) - val dataSourceAndDatabase = configureDatabase(makeTestDataSourceProperties()) - dataSource = dataSourceAndDatabase.first - database = dataSourceAndDatabase.second - databaseTransaction(database) { - services = object : MockServices() { - override val keyManagementService: MockKeyManagementService = MockKeyManagementService(MINI_CORP_KEY, MEGA_CORP_KEY, OUR_KEY) - override val vaultService: VaultService = NodeVaultService(this) - - override fun recordTransactions(txs: Iterable) { - for (stx in txs) { - storageService.validatedTransactions.addTransaction(stx) - } - // Refactored to use notifyAll() as we have no other unit test for that method with multiple transactions. - vaultService.notifyAll(txs.map { it.tx }) - } - } - - services.fillWithSomeTestCash(howMuch = 100.DOLLARS, atLeastThisManyStates = 1, atMostThisManyStates = 1, - issuedBy = MEGA_CORP.ref(1), issuerKey = MEGA_CORP_KEY, ownedBy = OUR_PUBKEY_1) - services.fillWithSomeTestCash(howMuch = 400.DOLLARS, atLeastThisManyStates = 1, atMostThisManyStates = 1, - issuedBy = MEGA_CORP.ref(1), issuerKey = MEGA_CORP_KEY, ownedBy = OUR_PUBKEY_1) - services.fillWithSomeTestCash(howMuch = 80.DOLLARS, atLeastThisManyStates = 1, atMostThisManyStates = 1, - issuedBy = MINI_CORP.ref(1), issuerKey = MINI_CORP_KEY, ownedBy = OUR_PUBKEY_1) - services.fillWithSomeTestCash(howMuch = 80.SWISS_FRANCS, atLeastThisManyStates = 1, atMostThisManyStates = 1, - issuedBy = MINI_CORP.ref(1), issuerKey = MINI_CORP_KEY, ownedBy = OUR_PUBKEY_1) - - vaultService = services.vaultService.currentVault - } - } - - @After - fun tearDown() { - LogHelper.reset(NodeVaultService::class) - dataSource.close() - } - @Test fun trivial() { transaction { @@ -614,7 +563,7 @@ class CashTests { databaseTransaction(database) { val tx = TransactionType.General.Builder(DUMMY_NOTARY) - vault.generateSpend(tx, 80.DOLLARS, ALICE_PUBKEY, setOf(MINI_CORP)) + vault.generateSpend(tx, 80.DOLLARS, ALICE_PUBKEY, setOf(MINI_CORP.ref(1))) assertEquals(vaultService.states.elementAt(2).ref, tx.inputStates()[0]) } diff --git a/node/src/main/kotlin/com/r3corda/node/services/vault/NodeVaultService.kt b/node/src/main/kotlin/com/r3corda/node/services/vault/NodeVaultService.kt index 183f34c3fa..6f52bb528b 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/vault/NodeVaultService.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/vault/NodeVaultService.kt @@ -147,7 +147,7 @@ class NodeVaultService(private val services: ServiceHub) : SingletonSerializeAsT var acceptableCoins = run { val ofCurrency = assetsStates.filter { it.state.data.amount.token.product == currency } if (onlyFromIssuers != null) - ofCurrency.filter { it.state.data.amount.token.issuer.party in onlyFromIssuers } + ofCurrency.filter { it.state.data.amount.token.issuer in onlyFromIssuers } else ofCurrency }