From cd5088cc8bba84658ae7f5c3026aa810e602b30b Mon Sep 17 00:00:00 2001 From: Rick Parker Date: Tue, 26 Sep 2017 14:45:56 +0100 Subject: [PATCH] BIGINT fix for H2 coin selection. (#1658) * BIGINT fix for H2 coin selection. * Review feedback --- .../contracts/asset/cash/selection/CashSelectionH2Impl.kt | 2 +- .../src/main/kotlin/net/corda/traderdemo/TraderDemo.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt index fb3a84371b..7c18981857 100644 --- a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt +++ b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionH2Impl.kt @@ -77,7 +77,7 @@ class CashSelectionH2Impl : CashSelection { spendLock.withLock { val statement = services.jdbcSession().createStatement() try { - statement.execute("CALL SET(@t, 0);") + statement.execute("CALL SET(@t, CAST(0 AS BIGINT));") // we select spendable states irrespective of lock but prioritised by unlocked ones (Eg. null) // the softLockReserve update will detect whether we try to lock states locked by others diff --git a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt b/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt index 689d3b4e52..abcbc740e5 100644 --- a/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt +++ b/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt @@ -44,17 +44,17 @@ private class TraderDemo { } // What happens next depends on the role. The buyer sits around waiting for a trade to start. The seller role - // will contact the buyer and actually make something happen. + // will contact the buyer and actually make something happen. We intentionally use large amounts here. val role = options.valueOf(roleArg)!! if (role == Role.BANK) { val bankHost = NetworkHostAndPort("localhost", bankRpcPort) CordaRPCClient(bankHost).use("demo", "demo") { - TraderDemoClientApi(it.proxy).runIssuer(1100.DOLLARS, buyerName, sellerName) + TraderDemoClientApi(it.proxy).runIssuer(1_100_000_000.DOLLARS, buyerName, sellerName) } } else { val sellerHost = NetworkHostAndPort("localhost", sellerRpcPort) CordaRPCClient(sellerHost).use("demo", "demo") { - TraderDemoClientApi(it.proxy).runSeller(1000.DOLLARS, buyerName) + TraderDemoClientApi(it.proxy).runSeller(1_000_000_000.DOLLARS, buyerName) } } }