Is Corda support state deletion scenario?

江枫思渺然 提交于 2021-02-11 13:51:26

问题


Is corda support state deletion scenario when don't need to use some state (in both dev/prod) Because I face exception when start node like "class not found exception", It's happen when I delete state class in project and use same old persistence file.

I think it because of state class already insert in VAULT_STATES and it can't find that class when start node.

I expect to have some method that provide state deletion.

More info In Dev side I delete persistence file and of course it's work, but I just worry about Production side.


回答1:


As of Corda 3, if a node has a state stored as part of a transaction in its transaction storage or in its vault, the node needs to keep the state's class definition on its classpath permanently.

You can delete old transactions and states directly via the node's database, but only if the transactions are not required for transaction resolution. You would do this by dropping rows from the NODE_TRANSACTIONS and VAULT_STATES tables in the node's database (as well as any custom tables defined by the state's schemas if it is a QueryableState). However, if the deleted transactions are later required as part of transaction resolution, your node will throw an error.

Future versions of Corda may provide a mechanism to delete old or "non-current" states and transactions. You can find a discussion of what this process may look like here: https://groups.io/g/corda-dev/topic/20405353.




回答2:


For development purposes you can simply just delete the persistence.mv.db file which is the entire H2 database. This will reset your corda node.

Of course don't do that for any production use.



来源:https://stackoverflow.com/questions/54018125/is-corda-support-state-deletion-scenario

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!