mirror of
https://github.com/corda/corda.git
synced 2025-06-18 07:08:15 +00:00
Detangle issuers in NodeVaultServiceTest (#2057)
Detangle issuers in NodeVaultServiceTest, which has been using two keys on a single node, for different issuing identities, which doesn't work right now because we don't actually have multiple identity support. Also remove duplicate data in parameters to fillWithSomeTestCash().
This commit is contained in:
@ -123,7 +123,6 @@ public class VaultQueryJavaTests {
|
|||||||
3,
|
3,
|
||||||
3,
|
3,
|
||||||
new Random(),
|
new Random(),
|
||||||
new OpaqueBytes("1".getBytes()),
|
|
||||||
null,
|
null,
|
||||||
CashUtilities.getDUMMY_CASH_ISSUER());
|
CashUtilities.getDUMMY_CASH_ISSUER());
|
||||||
return tx;
|
return tx;
|
||||||
@ -200,10 +199,10 @@ public class VaultQueryJavaTests {
|
|||||||
Amount<Currency> dollars10 = new Amount<>(10, Currency.getInstance("USD"));
|
Amount<Currency> dollars10 = new Amount<>(10, Currency.getInstance("USD"));
|
||||||
Amount<Currency> dollars1 = new Amount<>(1, Currency.getInstance("USD"));
|
Amount<Currency> dollars1 = new Amount<>(1, Currency.getInstance("USD"));
|
||||||
|
|
||||||
VaultFiller.fillWithSomeTestCash(services, pounds, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, pounds, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, dollars100, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, dollars100, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, dollars10, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, dollars10, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, dollars1, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, dollars1, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
return tx;
|
return tx;
|
||||||
});
|
});
|
||||||
database.transaction(tx -> {
|
database.transaction(tx -> {
|
||||||
@ -247,7 +246,6 @@ public class VaultQueryJavaTests {
|
|||||||
3,
|
3,
|
||||||
3,
|
3,
|
||||||
new Random(),
|
new Random(),
|
||||||
new OpaqueBytes("1".getBytes()),
|
|
||||||
null,
|
null,
|
||||||
getDUMMY_CASH_ISSUER());
|
getDUMMY_CASH_ISSUER());
|
||||||
return tx;
|
return tx;
|
||||||
@ -323,11 +321,11 @@ public class VaultQueryJavaTests {
|
|||||||
Amount<Currency> pounds = new Amount<>(400, Currency.getInstance("GBP"));
|
Amount<Currency> pounds = new Amount<>(400, Currency.getInstance("GBP"));
|
||||||
Amount<Currency> swissfrancs = new Amount<>(500, Currency.getInstance("CHF"));
|
Amount<Currency> swissfrancs = new Amount<>(500, Currency.getInstance("CHF"));
|
||||||
|
|
||||||
VaultFiller.fillWithSomeTestCash(services, dollars100, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, dollars100, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, dollars200, issuerServices, TestConstants.getDUMMY_NOTARY(), 2, 2, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, dollars200, issuerServices, TestConstants.getDUMMY_NOTARY(), 2, 2, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, dollars300, issuerServices, TestConstants.getDUMMY_NOTARY(), 3, 3, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, dollars300, issuerServices, TestConstants.getDUMMY_NOTARY(), 3, 3, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, pounds, issuerServices, TestConstants.getDUMMY_NOTARY(), 4, 4, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, pounds, issuerServices, TestConstants.getDUMMY_NOTARY(), 4, 4, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, swissfrancs, issuerServices, TestConstants.getDUMMY_NOTARY(), 5, 5, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, swissfrancs, issuerServices, TestConstants.getDUMMY_NOTARY(), 5, 5, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
|
|
||||||
return tx;
|
return tx;
|
||||||
});
|
});
|
||||||
@ -371,11 +369,11 @@ public class VaultQueryJavaTests {
|
|||||||
Amount<Currency> pounds = new Amount<>(400, Currency.getInstance("GBP"));
|
Amount<Currency> pounds = new Amount<>(400, Currency.getInstance("GBP"));
|
||||||
Amount<Currency> swissfrancs = new Amount<>(500, Currency.getInstance("CHF"));
|
Amount<Currency> swissfrancs = new Amount<>(500, Currency.getInstance("CHF"));
|
||||||
|
|
||||||
VaultFiller.fillWithSomeTestCash(services, dollars100, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, dollars100, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, dollars200, issuerServices, TestConstants.getDUMMY_NOTARY(), 2, 2, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, dollars200, issuerServices, TestConstants.getDUMMY_NOTARY(), 2, 2, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, dollars300, issuerServices, TestConstants.getDUMMY_NOTARY(), 3, 3, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, dollars300, issuerServices, TestConstants.getDUMMY_NOTARY(), 3, 3, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, pounds, issuerServices, TestConstants.getDUMMY_NOTARY(), 4, 4, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, pounds, issuerServices, TestConstants.getDUMMY_NOTARY(), 4, 4, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, swissfrancs, issuerServices, TestConstants.getDUMMY_NOTARY(), 5, 5, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, swissfrancs, issuerServices, TestConstants.getDUMMY_NOTARY(), 5, 5, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
|
|
||||||
return tx;
|
return tx;
|
||||||
});
|
});
|
||||||
@ -434,10 +432,10 @@ public class VaultQueryJavaTests {
|
|||||||
Amount<Currency> pounds300 = new Amount<>(300, Currency.getInstance("GBP"));
|
Amount<Currency> pounds300 = new Amount<>(300, Currency.getInstance("GBP"));
|
||||||
Amount<Currency> pounds400 = new Amount<>(400, Currency.getInstance("GBP"));
|
Amount<Currency> pounds400 = new Amount<>(400, Currency.getInstance("GBP"));
|
||||||
|
|
||||||
VaultFiller.fillWithSomeTestCash(services, dollars100, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, dollars100, issuerServices, TestConstants.getDUMMY_NOTARY(), 1, 1, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, dollars200, issuerServices, TestConstants.getDUMMY_NOTARY(), 2, 2, new Random(0L), new OpaqueBytes("1".getBytes()), null, getBOC().ref(new OpaqueBytes("1".getBytes())));
|
VaultFiller.fillWithSomeTestCash(services, dollars200, issuerServices, TestConstants.getDUMMY_NOTARY(), 2, 2, new Random(0L), null, getBOC().ref(new OpaqueBytes("1".getBytes())));
|
||||||
VaultFiller.fillWithSomeTestCash(services, pounds300, issuerServices, TestConstants.getDUMMY_NOTARY(), 3, 3, new Random(0L), new OpaqueBytes("1".getBytes()), null, getDUMMY_CASH_ISSUER());
|
VaultFiller.fillWithSomeTestCash(services, pounds300, issuerServices, TestConstants.getDUMMY_NOTARY(), 3, 3, new Random(0L), null, getDUMMY_CASH_ISSUER());
|
||||||
VaultFiller.fillWithSomeTestCash(services, pounds400, issuerServices, TestConstants.getDUMMY_NOTARY(), 4, 4, new Random(0L), new OpaqueBytes("1".getBytes()), null, getBOC().ref(new OpaqueBytes("1".getBytes())));
|
VaultFiller.fillWithSomeTestCash(services, pounds400, issuerServices, TestConstants.getDUMMY_NOTARY(), 4, 4, new Random(0L), null, getBOC().ref(new OpaqueBytes("1".getBytes())));
|
||||||
|
|
||||||
return tx;
|
return tx;
|
||||||
});
|
});
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
package net.corda.node.services.vault
|
package net.corda.node.services.vault
|
||||||
|
|
||||||
import co.paralleluniverse.fibers.Suspendable
|
import co.paralleluniverse.fibers.Suspendable
|
||||||
import net.corda.core.contracts.*
|
import net.corda.core.contracts.Amount
|
||||||
|
import net.corda.core.contracts.Issued
|
||||||
|
import net.corda.core.contracts.StateAndRef
|
||||||
|
import net.corda.core.contracts.StateRef
|
||||||
import net.corda.core.crypto.generateKeyPair
|
import net.corda.core.crypto.generateKeyPair
|
||||||
import net.corda.core.identity.AbstractParty
|
import net.corda.core.identity.AbstractParty
|
||||||
import net.corda.core.identity.AnonymousParty
|
import net.corda.core.identity.AnonymousParty
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.internal.packageName
|
import net.corda.core.internal.packageName
|
||||||
import net.corda.core.node.StatesToRecord
|
import net.corda.core.node.StatesToRecord
|
||||||
import net.corda.core.node.services.*
|
import net.corda.core.node.services.StatesNotAvailableException
|
||||||
|
import net.corda.core.node.services.Vault
|
||||||
|
import net.corda.core.node.services.VaultService
|
||||||
|
import net.corda.core.node.services.queryBy
|
||||||
import net.corda.core.node.services.vault.PageSpecification
|
import net.corda.core.node.services.vault.PageSpecification
|
||||||
import net.corda.core.node.services.vault.QueryCriteria
|
import net.corda.core.node.services.vault.QueryCriteria
|
||||||
import net.corda.core.node.services.vault.QueryCriteria.*
|
import net.corda.core.node.services.vault.QueryCriteria.*
|
||||||
@ -54,19 +60,19 @@ class NodeVaultServiceTest {
|
|||||||
val testSerialization = SerializationEnvironmentRule()
|
val testSerialization = SerializationEnvironmentRule()
|
||||||
lateinit var services: MockServices
|
lateinit var services: MockServices
|
||||||
private lateinit var issuerServices: MockServices
|
private lateinit var issuerServices: MockServices
|
||||||
|
private lateinit var bocServices: MockServices
|
||||||
val vaultService get() = services.vaultService as NodeVaultService
|
val vaultService get() = services.vaultService as NodeVaultService
|
||||||
lateinit var database: CordaPersistence
|
lateinit var database: CordaPersistence
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
LogHelper.setLevel(NodeVaultService::class)
|
LogHelper.setLevel(NodeVaultService::class)
|
||||||
val databaseAndServices = MockServices.makeTestDatabaseAndMockServices(
|
val databaseAndServices = MockServices.makeTestDatabaseAndMockServices(cordappPackages = cordappPackages)
|
||||||
keys = listOf(BOC_KEY, DUMMY_CASH_ISSUER_KEY),
|
|
||||||
cordappPackages = cordappPackages
|
|
||||||
)
|
|
||||||
database = databaseAndServices.first
|
database = databaseAndServices.first
|
||||||
services = databaseAndServices.second
|
services = databaseAndServices.second
|
||||||
issuerServices = MockServices(cordappPackages, DUMMY_CASH_ISSUER_KEY, BOC_KEY)
|
issuerServices = MockServices(cordappPackages, DUMMY_CASH_ISSUER_KEY)
|
||||||
|
bocServices = MockServices(cordappPackages, BOC_KEY)
|
||||||
|
services.identityService.verifyAndRegisterIdentity(DUMMY_CASH_ISSUER_IDENTITY)
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@ -339,8 +345,8 @@ class NodeVaultServiceTest {
|
|||||||
@Test
|
@Test
|
||||||
fun `unconsumedStatesForSpending from two issuer parties`() {
|
fun `unconsumedStatesForSpending from two issuer parties`() {
|
||||||
database.transaction {
|
database.transaction {
|
||||||
services.fillWithSomeTestCash(100.DOLLARS, issuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (DUMMY_CASH_ISSUER))
|
services.fillWithSomeTestCash(100.DOLLARS, issuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = DUMMY_CASH_ISSUER)
|
||||||
services.fillWithSomeTestCash(100.DOLLARS, issuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (BOC.ref(1)))
|
services.fillWithSomeTestCash(100.DOLLARS, bocServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = BOC.ref(1))
|
||||||
}
|
}
|
||||||
database.transaction {
|
database.transaction {
|
||||||
val spendableStatesUSD = vaultService.unconsumedCashStatesForSpending(200.DOLLARS,
|
val spendableStatesUSD = vaultService.unconsumedCashStatesForSpending(200.DOLLARS,
|
||||||
@ -356,10 +362,10 @@ class NodeVaultServiceTest {
|
|||||||
@Test
|
@Test
|
||||||
fun `unconsumedStatesForSpending from specific issuer party and refs`() {
|
fun `unconsumedStatesForSpending from specific issuer party and refs`() {
|
||||||
database.transaction {
|
database.transaction {
|
||||||
services.fillWithSomeTestCash(100.DOLLARS, issuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (DUMMY_CASH_ISSUER))
|
services.fillWithSomeTestCash(100.DOLLARS, issuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = DUMMY_CASH_ISSUER)
|
||||||
services.fillWithSomeTestCash(100.DOLLARS, issuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (BOC.ref(1)), ref = OpaqueBytes.of(1))
|
services.fillWithSomeTestCash(100.DOLLARS, bocServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = BOC.ref(1))
|
||||||
services.fillWithSomeTestCash(100.DOLLARS, issuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (BOC.ref(2)), ref = OpaqueBytes.of(2))
|
services.fillWithSomeTestCash(100.DOLLARS, bocServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = BOC.ref(2))
|
||||||
services.fillWithSomeTestCash(100.DOLLARS, issuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (BOC.ref(3)), ref = OpaqueBytes.of(3))
|
services.fillWithSomeTestCash(100.DOLLARS, bocServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = BOC.ref(3))
|
||||||
}
|
}
|
||||||
database.transaction {
|
database.transaction {
|
||||||
val unconsumedStates = vaultService.queryBy<Cash.State>().states
|
val unconsumedStates = vaultService.queryBy<Cash.State>().states
|
||||||
@ -505,15 +511,15 @@ class NodeVaultServiceTest {
|
|||||||
service.updates.subscribe(this)
|
service.updates.subscribe(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
val anonymousIdentity = services.keyManagementService.freshKeyAndCert(services.myInfo.chooseIdentityAndCert(), false)
|
val identity = services.myInfo.singleIdentityAndCert()
|
||||||
|
val anonymousIdentity = services.keyManagementService.freshKeyAndCert(identity, false)
|
||||||
val thirdPartyIdentity = AnonymousParty(generateKeyPair().public)
|
val thirdPartyIdentity = AnonymousParty(generateKeyPair().public)
|
||||||
val amount = Amount(1000, Issued(BOC.ref(1), GBP))
|
val amount = Amount(1000, Issued(BOC.ref(1), GBP))
|
||||||
|
|
||||||
// Issue then move some cash
|
// Issue then move some cash
|
||||||
val issueTx = TransactionBuilder(services.myInfo.chooseIdentity()).apply {
|
val issueTx = TransactionBuilder(identity.party).apply {
|
||||||
Cash().generateIssue(this,
|
Cash().generateIssue(this, amount, anonymousIdentity.party.anonymise(), identity.party)
|
||||||
amount, anonymousIdentity.party, services.myInfo.chooseIdentity())
|
}.toWireTransaction(bocServices)
|
||||||
}.toWireTransaction(services)
|
|
||||||
val cashState = StateAndRef(issueTx.outputs.single(), StateRef(issueTx.id, 0))
|
val cashState = StateAndRef(issueTx.outputs.single(), StateRef(issueTx.id, 0))
|
||||||
|
|
||||||
database.transaction { service.notify(StatesToRecord.ONLY_RELEVANT, issueTx) }
|
database.transaction { service.notify(StatesToRecord.ONLY_RELEVANT, issueTx) }
|
||||||
@ -540,15 +546,18 @@ class NodeVaultServiceTest {
|
|||||||
service.updates.subscribe(this)
|
service.updates.subscribe(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
val anonymousIdentity = services.keyManagementService.freshKeyAndCert(services.myInfo.chooseIdentityAndCert(), false)
|
val identity = services.myInfo.singleIdentityAndCert()
|
||||||
val thirdPartyIdentity = AnonymousParty(generateKeyPair().public)
|
assertEquals(services.identityService.partyFromKey(identity.owningKey), identity.party)
|
||||||
|
val anonymousIdentity = services.keyManagementService.freshKeyAndCert(identity, false)
|
||||||
|
val thirdPartyServices = MockServices()
|
||||||
|
val thirdPartyIdentity = thirdPartyServices.keyManagementService.freshKeyAndCert(thirdPartyServices.myInfo.singleIdentityAndCert(), false)
|
||||||
val amount = Amount(1000, Issued(BOC.ref(1), GBP))
|
val amount = Amount(1000, Issued(BOC.ref(1), GBP))
|
||||||
|
|
||||||
// Issue some cash
|
// Issue some cash
|
||||||
val issueTxBuilder = TransactionBuilder(notary).apply {
|
val issueTxBuilder = TransactionBuilder(notary).apply {
|
||||||
Cash().generateIssue(this, amount, anonymousIdentity.party, notary)
|
Cash().generateIssue(this, amount, anonymousIdentity.party, notary)
|
||||||
}
|
}
|
||||||
val issueStx = services.signInitialTransaction(issueTxBuilder)
|
val issueStx = bocServices.signInitialTransaction(issueTxBuilder)
|
||||||
// We need to record the issue transaction so inputs can be resolved for the notary change transaction
|
// We need to record the issue transaction so inputs can be resolved for the notary change transaction
|
||||||
services.validatedTransactions.addTransaction(issueStx)
|
services.validatedTransactions.addTransaction(issueStx)
|
||||||
|
|
||||||
@ -566,7 +575,7 @@ class NodeVaultServiceTest {
|
|||||||
// Move cash
|
// Move cash
|
||||||
val moveTx = database.transaction {
|
val moveTx = database.transaction {
|
||||||
TransactionBuilder(newNotary).apply {
|
TransactionBuilder(newNotary).apply {
|
||||||
Cash.generateSpend(services, this, Amount(1000, GBP), thirdPartyIdentity)
|
Cash.generateSpend(services, this, Amount(amount.quantity, GBP), anonymousIdentity, thirdPartyIdentity.party.anonymise())
|
||||||
}.toWireTransaction(services)
|
}.toWireTransaction(services)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1466,10 +1466,10 @@ class VaultQueryTests {
|
|||||||
database.transaction {
|
database.transaction {
|
||||||
identitySvc.verifyAndRegisterIdentity(BOC_IDENTITY)
|
identitySvc.verifyAndRegisterIdentity(BOC_IDENTITY)
|
||||||
|
|
||||||
services.fillWithSomeTestCash(100.DOLLARS, notaryServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (DUMMY_CASH_ISSUER))
|
services.fillWithSomeTestCash(100.DOLLARS, notaryServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = DUMMY_CASH_ISSUER)
|
||||||
services.fillWithSomeTestCash(100.DOLLARS, notaryServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (BOC.ref(1)), ref = OpaqueBytes.of(1))
|
services.fillWithSomeTestCash(100.DOLLARS, notaryServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = BOC.ref(1))
|
||||||
services.fillWithSomeTestCash(100.DOLLARS, notaryServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (BOC.ref(2)), ref = OpaqueBytes.of(2))
|
services.fillWithSomeTestCash(100.DOLLARS, notaryServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = BOC.ref(2))
|
||||||
services.fillWithSomeTestCash(100.DOLLARS, notaryServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (BOC.ref(3)), ref = OpaqueBytes.of(3))
|
services.fillWithSomeTestCash(100.DOLLARS, notaryServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = BOC.ref(3))
|
||||||
}
|
}
|
||||||
database.transaction {
|
database.transaction {
|
||||||
val criteria = FungibleAssetQueryCriteria(issuer = listOf(BOC),
|
val criteria = FungibleAssetQueryCriteria(issuer = listOf(BOC),
|
||||||
|
@ -112,7 +112,6 @@ fun ServiceHub.fillWithSomeTestCash(howMuch: Amount<Currency>,
|
|||||||
atLeastThisManyStates: Int = 3,
|
atLeastThisManyStates: Int = 3,
|
||||||
atMostThisManyStates: Int = 10,
|
atMostThisManyStates: Int = 10,
|
||||||
rng: Random = Random(),
|
rng: Random = Random(),
|
||||||
ref: OpaqueBytes = OpaqueBytes(ByteArray(1, { 1 })),
|
|
||||||
ownedBy: AbstractParty? = null,
|
ownedBy: AbstractParty? = null,
|
||||||
issuedBy: PartyAndReference = DUMMY_CASH_ISSUER): Vault<Cash.State> {
|
issuedBy: PartyAndReference = DUMMY_CASH_ISSUER): Vault<Cash.State> {
|
||||||
val amounts = calculateRandomlySizedAmounts(howMuch, atLeastThisManyStates, atMostThisManyStates, rng)
|
val amounts = calculateRandomlySizedAmounts(howMuch, atLeastThisManyStates, atMostThisManyStates, rng)
|
||||||
@ -124,7 +123,7 @@ fun ServiceHub.fillWithSomeTestCash(howMuch: Amount<Currency>,
|
|||||||
val cash = Cash()
|
val cash = Cash()
|
||||||
val transactions: List<SignedTransaction> = amounts.map { pennies ->
|
val transactions: List<SignedTransaction> = amounts.map { pennies ->
|
||||||
val issuance = TransactionBuilder(null as Party?)
|
val issuance = TransactionBuilder(null as Party?)
|
||||||
cash.generateIssue(issuance, Amount(pennies, Issued(issuedBy.copy(reference = ref), howMuch.token)), anonParty, outputNotary)
|
cash.generateIssue(issuance, Amount(pennies, Issued(issuedBy, howMuch.token)), anonParty, outputNotary)
|
||||||
|
|
||||||
return@map issuerServices.signInitialTransaction(issuance, issuedBy.party.owningKey)
|
return@map issuerServices.signInitialTransaction(issuance, issuedBy.party.owningKey)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user