0
votes

I created persistent postgresql databases for nodes in corda. After setting up the databases and building nodes I'm able to record flow to the database, but after rebuilding nodes and running them again I'm unable to create the same flow anymore.

I guess this is means that the database still has old information about the nodes, but then how one can update the nodes and retain the old states from the database?

This is the error I get from running the same flow after rebuilding.

"net.corda.core.CordaRuntimeException: The Initiator of CollectSignaturesFlow must pass in exactly the sessions required to sign the transaction. "

My deployNodes task:

task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
    directory "./build/nodes"
    ext.drivers = ['.jdbc_driver']
    ext.extraConfig = [
            'dataSourceProperties.dataSourceClassName' : "org.postgresql.ds.PGSimpleDataSource",
            'database.transactionIsolationLevel' : 'READ_COMMITTED',
            'database.initialiseSchema': "true"
    ]
    nodeDefaults {
        projectCordapp {
            deploy = false
        }
        cordapp project(':cordapp-contracts-states')
        cordapp project(':cordapp')
    }
    node {
        name "O=NetworkMapAndNotary,L=Helsinki,C=FI"
        notary = [validating : true]
        rpcSettings {
            address "localhost:10004"
            adminAddress "localhost:10044"
        }
        p2pPort 10002
        extraConfig = ext.extraConfig + [
                'dataSourceProperties.dataSource.url' :
                        "jdbc:postgresql://localhost:5432/nms_db?currentSchema=nms_schema",
                'dataSourceProperties.dataSource.user' : "nms_corda",
                'dataSourceProperties.dataSource.password' : "corda1234",

        ]
        drivers = ext.drivers
    }
    node {
        name "O=AccountOperator,L=Helsinki,C=FI"
        p2pPort 10005
        rpcSettings {
            address "localhost:10006"
            adminAddress "localhost:10046"
        }
        webPort 10007
        rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
        extraConfig = ext.extraConfig + [
                'dataSourceProperties.dataSource.url' :
                        "jdbc:postgresql://localhost:5432/ao_db?currentSchema=ao_schema",
                'dataSourceProperties.dataSource.user' : "ao_corda",
                'dataSourceProperties.dataSource.password' : "corda1234",
        ]
        drivers = ext.drivers
    }
}

I have also tried running run clearNetworkMapCacheon each node's rpc. After running it I can see that node_info_hash, and node_infos tables are empty but then how can I update those tables with right node info?

For example this Migrating data from Corda 2 to Corda 3 question says I should rerun every transaction after upgrading cordapps, is this applicable also in just regular cordapp update and this is done? Also this https://docs.corda.net/head/node-operations-upgrade-cordapps.html instruction says "CorDapps must ship with database migration scripts or clear documentation about how to update the database to be compatible with the new version." But I tried migrate some previous states to new database instance with no luck.

1
Hey Yuuhaa couple of additional questions for you: did you change the version of Corda you are using when you rebuilt? Which version of Corda are you using currently? - Nicholas Rogers

1 Answers

0
votes

I face this issue once when I migrate code from Corda3 to Corda4, so I fix it by send session in both CollectSignatureFlow and Finality flow.

Hope that help