diff --git a/node/src/main/kotlin/com/r3corda/node/internal/testing/WalletFiller.kt b/node/src/main/kotlin/com/r3corda/node/internal/testing/WalletFiller.kt index ca9dc37058..8d87bf0a16 100644 --- a/node/src/main/kotlin/com/r3corda/node/internal/testing/WalletFiller.kt +++ b/node/src/main/kotlin/com/r3corda/node/internal/testing/WalletFiller.kt @@ -5,6 +5,7 @@ import com.r3corda.core.contracts.Amount import com.r3corda.core.contracts.TransactionBuilder import com.r3corda.core.crypto.Party import com.r3corda.core.node.ServiceHub +import com.r3corda.core.serialization.OpaqueBytes import java.util.* object WalletFiller { @@ -18,7 +19,8 @@ object WalletFiller { * the central bank, well ... that'd be a different story altogether. */ fun fillWithSomeTestCash(services: ServiceHub, notary: Party, howMuch: Amount, atLeastThisManyStates: Int = 3, - atMostThisManyStates: Int = 10, rng: Random = Random()) { + atMostThisManyStates: Int = 10, rng: Random = Random(), + ref: OpaqueBytes = OpaqueBytes(ByteArray(1, { 0 }))) { val amounts = calculateRandomlySizedAmounts(howMuch, atLeastThisManyStates, atMostThisManyStates, rng) val myIdentity = services.storageService.myLegalIdentity @@ -29,7 +31,7 @@ object WalletFiller { val transactions = amounts.map { pennies -> // This line is what makes the cash self issued. We just use zero as our deposit reference: we don't need // this field as there's no other database or source of truth we need to sync with. - val depositRef = myIdentity.ref(0) + val depositRef = myIdentity.ref(ref) val issuance = TransactionBuilder() val freshKey = services.keyManagementService.freshKey() diff --git a/node/src/main/kotlin/com/r3corda/node/services/wallet/NodeWalletService.kt b/node/src/main/kotlin/com/r3corda/node/services/wallet/NodeWalletService.kt index b51d8a0f3f..6c015fa373 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/wallet/NodeWalletService.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/wallet/NodeWalletService.kt @@ -5,6 +5,7 @@ import com.r3corda.core.contracts.* import com.r3corda.core.crypto.SecureHash import com.r3corda.core.node.services.Wallet import com.r3corda.core.node.services.WalletService +import com.r3corda.core.serialization.OpaqueBytes import com.r3corda.core.serialization.SingletonSerializeAsToken import com.r3corda.core.utilities.loggerFor import com.r3corda.core.utilities.trace diff --git a/node/src/test/kotlin/com/r3corda/node/services/NodeWalletServiceTest.kt b/node/src/test/kotlin/com/r3corda/node/services/NodeWalletServiceTest.kt index ff228c6bd8..c7d870f46f 100644 --- a/node/src/test/kotlin/com/r3corda/node/services/NodeWalletServiceTest.kt +++ b/node/src/test/kotlin/com/r3corda/node/services/NodeWalletServiceTest.kt @@ -8,6 +8,7 @@ import com.r3corda.core.contracts.verifyToLedgerTransaction import com.r3corda.core.node.ServiceHub import com.r3corda.core.node.services.testing.MockKeyManagementService import com.r3corda.core.node.services.testing.MockStorageService +import com.r3corda.core.serialization.OpaqueBytes import com.r3corda.core.testing.* import com.r3corda.core.utilities.BriefLogFormatter import com.r3corda.node.internal.testing.WalletFiller @@ -40,10 +41,11 @@ class NodeWalletServiceTest { @Test fun splits() { val (wallet, services) = make() + val ref = OpaqueBytes(ByteArray(1, {0})) kms.nextKeys += Array(3) { ALICE_KEY } // Fix the PRNG so that we get the same splits every time. - WalletFiller.fillWithSomeTestCash(services, DUMMY_NOTARY, 100.DOLLARS, 3, 3, Random(0L)) + WalletFiller.fillWithSomeTestCash(services, DUMMY_NOTARY, 100.DOLLARS, 3, 3, Random(0L), ref) val w = wallet.currentWallet assertEquals(3, w.states.size)