Warm tip: This article is reproduced from stackoverflow.com, please click
corda

How to pass different CorDapp config to different nodes when using MockNetwork

发布于 2020-04-16 12:30:18

I am writing a test for flows using MockNetwork. There is a counter-flow on one of the mock nodes that is using CorDapp's CordappContext.config to determine the course of action. I am looking for a way to pass config parameters into the CorDapps on individual mock nodes. It does not look like there is a way of doing so through MockNodeConfigOverrides, and TestCordapp.withConfig(...) only seems to apply to the network level. What am I missing?

Questioner
Igor
Viewed
24
Igor 2020-02-04 20:03

It is possible to have different config map to CorDapps installed on different mock nodes. This has to be done through TestCordapp.withConfig(...) passed into MockNodeParameters.additionalCordapps when creating each individual node, as opposed to MockNetworkParameters.cordappsForAllNodes. Effectively the same TestCordapp needs to be applied to each mock node but the config map will be different.