mirror of
https://github.com/corda/corda.git
synced 2025-06-21 16:49:45 +00:00
addDefaultFixes to IRS Demo to make it work (#885)
This commit is contained in:
committed by
GitHub
parent
aaf7de0d02
commit
6b17a9a948
@ -27,6 +27,7 @@ import net.corda.core.transactions.FilteredTransaction
|
|||||||
import net.corda.core.utilities.ProgressTracker
|
import net.corda.core.utilities.ProgressTracker
|
||||||
import net.corda.core.utilities.unwrap
|
import net.corda.core.utilities.unwrap
|
||||||
import net.corda.irs.flows.RatesFixFlow
|
import net.corda.irs.flows.RatesFixFlow
|
||||||
|
import org.apache.commons.io.IOUtils
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.security.PublicKey
|
import java.security.PublicKey
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
@ -90,7 +91,12 @@ object NodeInterestRates {
|
|||||||
services.myInfo.serviceIdentities(type).first(),
|
services.myInfo.serviceIdentities(type).first(),
|
||||||
services.myInfo.serviceIdentities(type).first().owningKey.keys.first { services.keyManagementService.keys.contains(it) },
|
services.myInfo.serviceIdentities(type).first().owningKey.keys.first { services.keyManagementService.keys.contains(it) },
|
||||||
services
|
services
|
||||||
)
|
) {
|
||||||
|
// Set some default fixes to the Oracle, so we can smoothly run the IRS Demo without uploading fixes.
|
||||||
|
// This is required to avoid a situation where the runnodes version of the demo isn't in a good state
|
||||||
|
// upon startup.
|
||||||
|
addDefaultFixes()
|
||||||
|
}
|
||||||
// DOCEND 3
|
// DOCEND 3
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@ -179,6 +185,10 @@ object NodeInterestRates {
|
|||||||
fun uploadFixes(s: String) {
|
fun uploadFixes(s: String) {
|
||||||
knownFixes = parseFile(s)
|
knownFixes = parseFile(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun addDefaultFixes() {
|
||||||
|
knownFixes = parseFile(IOUtils.toString(Thread.currentThread().contextClassLoader.getResourceAsStream("net/corda/irs/simulation/example.rates.txt"), Charsets.UTF_8.name()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: can we split into two? Fix not available (retryable/transient) and unknown (permanent)
|
// TODO: can we split into two? Fix not available (retryable/transient) and unknown (permanent)
|
||||||
|
Reference in New Issue
Block a user