mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
Introduced FlowLogic.getFlowContext which provides the flow version and app name of the other side.
This commit is contained in:
@ -8,10 +8,7 @@ import net.corda.core.node.PluginServiceHub
|
||||
import net.corda.core.node.services.CordaService
|
||||
import net.corda.core.node.services.TimeWindowChecker
|
||||
import net.corda.core.node.services.TrustedAuthorityNotaryService
|
||||
import net.corda.core.transactions.LedgerTransaction
|
||||
import net.corda.core.transactions.SignedTransaction
|
||||
import net.corda.core.transactions.WireTransaction
|
||||
import net.corda.core.utilities.unwrap
|
||||
import net.corda.node.services.transactions.PersistentUniquenessProvider
|
||||
import net.corda.node.services.transactions.ValidatingNotaryService
|
||||
import java.security.SignatureException
|
||||
@ -26,9 +23,7 @@ class MyCustomValidatingNotaryService(override val services: PluginServiceHub) :
|
||||
override val timeWindowChecker = TimeWindowChecker(services.clock)
|
||||
override val uniquenessProvider = PersistentUniquenessProvider()
|
||||
|
||||
override fun createServiceFlow(otherParty: Party, platformVersion: Int): FlowLogic<Void?> {
|
||||
return MyValidatingNotaryFlow(otherParty, this)
|
||||
}
|
||||
override fun createServiceFlow(otherParty: Party): FlowLogic<Void?> = MyValidatingNotaryFlow(otherParty, this)
|
||||
|
||||
override fun start() {}
|
||||
override fun stop() {}
|
||||
@ -38,9 +33,8 @@ class MyCustomValidatingNotaryService(override val services: PluginServiceHub) :
|
||||
// START 2
|
||||
class MyValidatingNotaryFlow(otherSide: Party, service: MyCustomValidatingNotaryService) : NotaryFlow.Service(otherSide, service) {
|
||||
/**
|
||||
* The received transaction is checked for contract-validity, which requires fully resolving it into a
|
||||
* [TransactionForVerification], for which the caller also has to to reveal the whole transaction
|
||||
* dependency chain.
|
||||
* The received transaction is checked for contract-validity, for which the caller also has to to reveal the whole
|
||||
* transaction dependency chain.
|
||||
*/
|
||||
@Suspendable
|
||||
override fun receiveAndVerifyTx(): TransactionParts {
|
||||
@ -58,14 +52,10 @@ class MyValidatingNotaryFlow(otherSide: Party, service: MyCustomValidatingNotary
|
||||
}
|
||||
}
|
||||
|
||||
fun processTransaction(stx: SignedTransaction) {
|
||||
// Add custom transaction processing logic here
|
||||
}
|
||||
|
||||
private fun checkSignatures(stx: SignedTransaction) {
|
||||
try {
|
||||
stx.verifySignaturesExcept(serviceHub.myInfo.notaryIdentity.owningKey)
|
||||
} catch(e: SignatureException) {
|
||||
} catch (e: SignatureException) {
|
||||
throw NotaryException(NotaryError.TransactionInvalid(e))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user