Ivan
Ivan

Reputation: 480

How to re-validate all transactions on a Corda node

We use Corda Open Source 4.3 network with several nodes. One of the nodes is an observer node where all transactions are being sent from all nodes.

Is there a way at any given moment of time perform validation/verification of all transactions available on observer node? Or can it be doen on validating notary?

I understand that they might be validated upon receiving them, but I am interested in recursive on demand validation .

Upvotes: 0

Views: 80

Answers (1)

Ashutosh Meher
Ashutosh Meher

Reputation: 1821

You could use the TransactionVerifierService to verify a LedgerTransaction within a flow.

First, you would need a list of all available transactions with the node. You could get the list using the below code:

getServiceHub().getValidatedTransactions().track().getSnapshot()

This would return a list of SignedTransaction.

To verify this using TransactionVerifierService the SignedTransaction needs to be converted to LedgerTransaction. It could be done using the below code:

signedTransaction.toLedgerTransaction(getServiceHub());

Once you get the LedgerTransaction use the TransactionVerifierService to verify the transaction:

getServiceHub().getTransactionVerifierService().verify(ledgerTransaction);

Hope this helps!

Upvotes: 1

Related Questions