Matthew Layton
Matthew Layton

Reputation: 42260

Corda - Service origin and ourIdentity are different identities

I have implemented a Corda service designed to auto-complete a state transition. It works by observing particular vault states and then starting a flow for the states that match the vault criteria.

When running the flow tests however, the process hangs once it hits the service. I've logged some output from the service which makes no sense to me

logger.info("Our Identity = $ourIdentity")

Where ourIdentity is implemented as:

private val ourIdentity: Party
    get() = serviceHub.myInfo.legalIdentities.first()

What doesn't make a great deal of sense is what is logged after this output...

[INFO] 15:27:59,145 AutoCompleteService. Our Identity = O=Bank A, L=London, C=GB {
    actor_id=Only For Testing, 
    actor_owning_identity=O=Bank B, L=London, C=GB, 
    actor_store_id=TEST, 
    fiber-id=10000128, 
    flow-id=e40a3ee1-e1ac-4d9d-9fb7-be6cff1f2f34, 
    invocation_id=61787f49-1ecb-4663-a038-768c3b757ea7, 
    invocation_timestamp=2020-03-28T15:27:59.115Z, 
    origin=O=Bank B, L=London, C=GB, 
    session_id=61787f49-1ecb-4663-a038-768c3b757ea7, 
    session_timestamp=2020-03-28T15:27:59.115Z, 
    thread-id=6759
}

Specifically, why is this reporting actor_owning_identity and origin to be Bank B when ourIdentity reports the node identity to be Bank A?

P.S. this is running in a flow test using MockNetwork.

Upvotes: 1

Views: 108

Answers (1)

Wayne Lam
Wayne Lam

Reputation: 141

The services exist in all nodes with the Cordapp and we trigger on all of them with the states.

It looks the arrival order is surprising for the services. In that case, you will have to manage which nodes actually process which events.

Upvotes: 1

Related Questions