public final class NodeProxy extends AbstractCloseableNativeProxy implements Node
nativeHandle| Constructor and Description |
|---|
NodeProxy(long nativeHandle)
Creates a proxy of a node.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
disposeInternal()
Releases any resources owned by this proxy (e.g., the corresponding native object).
|
com.exonum.binding.common.crypto.PublicKey |
getPublicKey()
Returns the service public key of this node.
|
com.exonum.binding.common.hash.HashCode |
submitTransaction(RawTransaction rawTransaction)
Creates a transaction from the given parameters, signs it with
the node service key, and then submits it into Exonum network.
|
<ResultT> ResultT |
withSnapshot(Function<Snapshot,ResultT> snapshotFunction)
Performs the given function with a snapshot of the current database state.
|
close, getNativeHandleisValidHandlepublic NodeProxy(long nativeHandle)
nativeHandle - an implementation-specific reference to a native nodepublic com.exonum.binding.common.hash.HashCode submitTransaction(RawTransaction rawTransaction)
Incorrect transactions (e.g., the payload of which cannot be deserialized by the target service, or which have unknown message id) are rejected by the network.
Be aware that each node has its own service key pair, therefore invocations of this method on different nodes will produce different transactions.
submitTransaction in interface NoderawTransaction - transaction parameters to include in transaction messageIllegalStateException - if the node proxy is closedBlockchain.getTxMessages()public <ResultT> ResultT withSnapshot(Function<Snapshot,ResultT> snapshotFunction)
withSnapshot in interface NodeResultT - a type the function returnssnapshotFunction - a function to executeIllegalStateException - if the node proxy is closedpublic com.exonum.binding.common.crypto.PublicKey getPublicKey()
Node.submitTransaction(RawTransaction).
This key is stored under "service_public_key" key in the node configuration file.
getPublicKey in interface NodeIllegalStateException - if the node proxy is closedprotected void disposeInternal()
AbstractCloseableNativeProxyThis method is only called once from AbstractCloseableNativeProxy.close() for a valid
proxy and shall not be called directly.
disposeInternal in class AbstractCloseableNativeProxyCopyright © 2019 Exonum. All rights reserved.