Corda AccountSDK keys are missing from counterparty

After creating an account & key, I want to share it with another node, so I used the ShareAccountInfo flow. But when I use accountService.accountInfo(pubKey) on the other node, it returns null. But when I query using accountService.allAccounts() I can see the account. Is this supposed to happen?

The mapping from account to public-key mapping is 1 to Many. So 1 account can have many public keys mapped to it. So merely querying all accounts doesn’t mean the mapping from a public key to an account is available. So I suspect you are not sharing the correct public key. As in an ideal situation if the mapping is correct, then accountService.accountInfo(pubKey) should return the correct AccountInfo