diff --git a/scripts/get-rate-fix.sh b/scripts/get-rate-fix.sh index b5e95c99e1..504649224c 100755 --- a/scripts/get-rate-fix.sh +++ b/scripts/get-rate-fix.sh @@ -7,7 +7,9 @@ if [ ! -e ./gradlew ]; then exit 1 fi -if [ ! -d build/install/r3prototyping/bin/get-rate-fix ]; then +bin="build/install/r3prototyping/bin/get-rate-fix" + +if [ ! -e $bin ]; then ./gradlew installDist fi @@ -19,4 +21,4 @@ fi # Upload the rates to the buyer node curl -F rates=@scripts/example.rates.txt http://localhost:31338/upload/interest-rates -build/install/r3prototyping/bin/get-rate-fix --network-address=localhost:31300 --oracle=localhost --oracle-identity-file=buyer/identity-public \ No newline at end of file +$bin --network-address=localhost:31300 --oracle=localhost --oracle-identity-file=buyer/identity-public \ No newline at end of file diff --git a/src/main/kotlin/demos/RateFixDemo.kt b/src/main/kotlin/demos/RateFixDemo.kt index 24b71647e4..8a5c3ccbae 100644 --- a/src/main/kotlin/demos/RateFixDemo.kt +++ b/src/main/kotlin/demos/RateFixDemo.kt @@ -79,12 +79,11 @@ fun main(args: Array) { val protocol = RatesFixProtocol(tx, oracleNode, fixOf, expectedRate, rateTolerance) ANSIProgressRenderer.progressTracker = protocol.progressTracker node.smm.add("demo.ratefix", protocol).get() + node.stop() // Show the user the output. println("Got rate fix") println() print(Emoji.renderIfSupported(tx.toWireTransaction())) println(tx.toSignedTransaction().sigs) - - node.stop() } \ No newline at end of file diff --git a/src/main/kotlin/protocols/RatesFixProtocol.kt b/src/main/kotlin/protocols/RatesFixProtocol.kt index ad955983d8..b919a81311 100644 --- a/src/main/kotlin/protocols/RatesFixProtocol.kt +++ b/src/main/kotlin/protocols/RatesFixProtocol.kt @@ -14,6 +14,7 @@ import core.crypto.DigitalSignature import core.messaging.LegallyIdentifiableNode import core.messaging.SingleMessageRecipient import core.protocols.ProtocolLogic +import core.utilities.ProgressTracker import java.math.BigDecimal import java.util.* @@ -34,8 +35,14 @@ open class RatesFixProtocol(protected val tx: TransactionBuilder, private val rateTolerance: BigDecimal) : ProtocolLogic() { companion object { val TOPIC = "platform.rates.interest.fix" + + class QUERYING(val name: String) : ProgressTracker.Step("Querying oracle for $name interest rate") + object WORKING : ProgressTracker.Step("Working with data returned by oracle") + object SIGNING : ProgressTracker.Step("Requesting transaction signature from interest rate oracle") } + override val progressTracker = ProgressTracker(QUERYING(fixOf.name), WORKING, SIGNING) + class FixOutOfRange(val byAmount: BigDecimal) : Exception() data class QueryRequest(val queries: List, val replyTo: SingleMessageRecipient, val sessionID: Long)