mirror of
https://github.com/corda/corda.git
synced 2025-06-20 08:03:53 +00:00
Add CommitTransactionProtocol
Add new protocol which manages the entire process of taking a signed transaction ready for notarisation, through notarisation and onto recording it both locally and informing remote nodes. This protocol also optionally can include the ClientToServiceCommand which triggered a transaction being created, to give the remote nodes context on why a change occurred (i.e. "You are being sent £100")
This commit is contained in:
@ -87,7 +87,7 @@ fun main(args: Array<String>) {
|
||||
val tx = TransactionType.General.Builder(notaryNode.identity)
|
||||
tx.addOutputState(TransactionState(Cash.State(1500.DOLLARS `issued by` node.storage.myLegalIdentity.ref(1), node.keyManagement.freshKey().public), notaryNode.identity))
|
||||
val protocol = RatesFixProtocol(tx, rateOracle.identity, fixOf, expectedRate, rateTolerance)
|
||||
node.smm.add("demo.ratefix", protocol).get()
|
||||
node.services.startProtocol("demo.ratefix", protocol).get()
|
||||
node.stop()
|
||||
|
||||
// Show the user the output.
|
||||
|
@ -182,7 +182,7 @@ private fun runSeller(node: Node, amount: Amount<Currency>, otherSide: Party) {
|
||||
tradeTX = node.smm.findStateMachines(TraderDemoProtocolSeller::class.java).single().second
|
||||
} else {
|
||||
val seller = TraderDemoProtocolSeller(otherSide, amount)
|
||||
tradeTX = node.smm.add("demo.seller", seller)
|
||||
tradeTX = node.services.startProtocol("demo.seller", seller)
|
||||
}
|
||||
|
||||
tradeTX.success {
|
||||
@ -217,7 +217,7 @@ private fun runBuyer(node: Node, amount: Amount<Currency>) {
|
||||
// We use a simple scenario-specific wrapper protocol to make things happen.
|
||||
val otherSide = message.data.deserialize<Party>()
|
||||
val buyer = TraderDemoProtocolBuyer(otherSide, attachmentsPath, amount)
|
||||
node.smm.add("demo.buyer", buyer)
|
||||
node.services.startProtocol("demo.buyer", buyer)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user