Remove IssuerFlow

* Remove IssuerFlow as it is dangerous and its presence in the finance module risks accidental use in non-test code. As written it will issue arbitary amounts of currency on request from any node on the network, with no validation barring that the currency type is valid.
* Unify interface to CashIssueFlow to match the previous IssuerFlow
This commit is contained in:
Ross Nicoll
2017-08-11 14:03:23 +01:00
parent 3888635055
commit 89476904fc
29 changed files with 130 additions and 363 deletions

View File

@ -29,7 +29,6 @@ import net.corda.core.utilities.toNonEmptySet
import net.corda.flows.CashExitFlow
import net.corda.flows.CashIssueFlow
import net.corda.flows.CashPaymentFlow
import net.corda.flows.IssuerFlow
import net.corda.node.services.ContractUpgradeHandler
import net.corda.node.services.NotaryChangeHandler
import net.corda.node.services.NotifyTransactionHandler
@ -210,9 +209,6 @@ abstract class AbstractNode(open val configuration: NodeConfiguration,
findRPCFlows(scanResult)
}
// TODO Remove this once the cash stuff is in its own CorDapp
registerInitiatedFlow(IssuerFlow.Issuer::class.java)
runOnStop += network::stop
_networkMapRegistrationFuture.captureLater(registerWithNetworkMapIfConfigured())
smm.start()

View File

@ -95,7 +95,7 @@ class CordaRPCOpsImplTest {
// Tell the monitoring service node to issue some cash
val anonymous = false
val recipient = aliceNode.info.legalIdentity
val result = rpc.startFlow(::CashIssueFlow, Amount(quantity, GBP), ref, recipient, notaryNode.info.notaryIdentity, anonymous)
val result = rpc.startFlow(::CashIssueFlow, Amount(quantity, GBP), recipient, rpc.nodeIdentity().legalIdentity, ref, notaryNode.info.notaryIdentity, anonymous)
mockNet.runNetwork()
var issueSmId: StateMachineRunId? = null
@ -133,8 +133,9 @@ class CordaRPCOpsImplTest {
val anonymous = false
val result = rpc.startFlow(::CashIssueFlow,
100.DOLLARS,
OpaqueBytes(ByteArray(1, { 1 })),
aliceNode.info.legalIdentity,
rpc.nodeIdentity().legalIdentity,
OpaqueBytes(ByteArray(1, { 1 })),
notaryNode.info.notaryIdentity,
false
)
@ -213,8 +214,9 @@ class CordaRPCOpsImplTest {
assertThatExceptionOfType(PermissionException::class.java).isThrownBy {
rpc.startFlow(::CashIssueFlow,
Amount(100, USD),
OpaqueBytes(ByteArray(1, { 1 })),
aliceNode.info.legalIdentity,
rpc.nodeIdentity().legalIdentity,
OpaqueBytes(ByteArray(1, { 1 })),
notaryNode.info.notaryIdentity,
false
)

View File

@ -330,8 +330,9 @@ class FlowFrameworkTests {
assertEquals(notary1.info.notaryIdentity, notary2.info.notaryIdentity)
node1.services.startFlow(CashIssueFlow(
2000.DOLLARS,
OpaqueBytes.of(0x01),
node1.info.legalIdentity,
node1.info.legalIdentity,
OpaqueBytes.of(0x01),
notary1.info.notaryIdentity,
anonymous = false))
// We pay a couple of times, the notary picking should go round robin