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:
Ross Nicoll
2016-08-16 22:53:59 +01:00
parent a5344f9578
commit ad8ffca0b4
26 changed files with 304 additions and 185 deletions

View File

@ -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.

View File

@ -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)
}
}