CORDA-1864: Added getter for network parameters to RPC (#3892)

This commit is contained in:
Shams Asari 2018-09-05 11:17:13 +01:00 committed by GitHub
parent ce65a58c7c
commit be45096082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -76,7 +76,8 @@ sealed class StateMachineUpdate {
// DOCSTART 1
/**
* Data class containing information about the scheduled network parameters update. The info is emitted every time node
* receives network map with [ParametersUpdate] which wasn't seen before. For more information see: [CordaRPCOps.networkParametersFeed] and [CordaRPCOps.acceptNewNetworkParameters].
* receives network map with [ParametersUpdate] which wasn't seen before. For more information see: [CordaRPCOps.networkParametersFeed]
* and [CordaRPCOps.acceptNewNetworkParameters].
* @property hash new [NetworkParameters] hash
* @property parameters new [NetworkParameters] data structure
* @property description description of the update
@ -227,6 +228,9 @@ interface CordaRPCOps : RPCOps {
@RPCReturnsObservables
fun networkMapFeed(): DataFeed<List<NodeInfo>, NetworkMapCache.MapChange>
/** Returns the network parameters the node is operating under. */
val networkParameters: NetworkParameters
/**
* Returns [DataFeed] object containing information on currently scheduled parameters update (null if none are currently scheduled)
* and observable with future update events. Any update that occurs before the deadline automatically cancels the current one.

View File

@ -6,6 +6,8 @@ release, see :doc:`upgrade-notes`.
Unreleased
----------
* Getter added to ``CordaRPCOps`` for the node's network parameters.
* The RPC client library now checks at startup whether the server is of the client libraries major version or higher.
Therefore to connect to a Corda 4 node you must use version 4 or lower of the library. This behaviour can be overridden
by specifying a lower number in the ``CordaRPCClientConfiguration`` class.

View File

@ -19,6 +19,7 @@ import net.corda.core.internal.RPC_UPLOADER
import net.corda.core.internal.STRUCTURAL_STEP_PREFIX
import net.corda.core.internal.sign
import net.corda.core.messaging.*
import net.corda.core.node.NetworkParameters
import net.corda.core.node.NodeInfo
import net.corda.core.node.services.AttachmentId
import net.corda.core.node.services.NetworkMapCache
@ -61,6 +62,8 @@ internal class CordaRPCOpsImpl(
return snapshot
}
override val networkParameters: NetworkParameters get() = services.networkParameters
override fun networkParametersFeed(): DataFeed<ParametersUpdateInfo?, ParametersUpdateInfo> {
return services.networkMapUpdater.trackParametersUpdate()
}