In our Corda Project we are having two nodes, Node-A and Node-B. An account is created on Node-A and shared with Node-B. From Node-A We have requested a publickey using new RequestKeyForAccount(accountInfo)
. Node-B is not aware of this public key. So to synchronize the public keys We have invoked new SyncKeyMappingFlow(flowSession, Collections.singletonList(anonymousParty))
from Node-A. We have also implemented a responder flow on Node-B which invokes the new SyncKeyMappingFlowHandler(flowSession))
subflow. Both the initiator and responder flow are working fine. When tried to look up the List of publickeys belonging to the account on the Node-B using accountService.accountKeys(accountInfo.getState().getData().getLinearId().getId()).toString())
we are getting an Empty list. Ideally we should be getting the public key that we requested on the Node-A. Is this this the appropriate approach to synchronize the public keys? Suggest an alternative approach if this is a flawed approach.
0
votes
1 Answers
0
votes
According to the source code, the accountKey
will only return the keys which have been generated on the calling node.
Here is the reference: https://github.com/corda/accounts/blob/master/workflows/src/main/kotlin/com/r3/corda/lib/accounts/workflows/services/AccountService.kt#L66
accountservice.ouraccounts())
.I have checked the Node-B and Node-A logs and found no errors. – nikhilsarikaourAccounts()
only returns the accounts where the current node is thehost
; Node-B is not the host. – Adel Rustum