0
votes

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.

1
Before syncing the key mapping; can you confirm that Node-B actually received the account that was created on Node-A? Can you query it on Node-B? Also check the logs of your nodes and see if there any useful messages there.Adel Rustum
The Account is shared with Node-B right after the creation of the account. But as mentioned in the bellow answer I am getting only the accounts created on the Node-B( account shared by Node-A is not returned as part of accountservice.ouraccounts()).I have checked the Node-B and Node-A logs and found no errors.nikhilsarika
ourAccounts() only returns the accounts where the current node is the host; Node-B is not the host.Adel Rustum

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