mirror of
https://github.com/corda/corda.git
synced 2025-01-31 00:24:59 +00:00
Disable hash constraints using system property.
This commit is contained in:
parent
060bbb0a9d
commit
e252401169
@ -4,7 +4,6 @@ import net.corda.core.DeleteForDJVM
|
|||||||
import net.corda.core.concurrent.CordaFuture
|
import net.corda.core.concurrent.CordaFuture
|
||||||
import net.corda.core.contracts.*
|
import net.corda.core.contracts.*
|
||||||
import net.corda.core.contracts.TransactionVerificationException.TransactionContractConflictException
|
import net.corda.core.contracts.TransactionVerificationException.TransactionContractConflictException
|
||||||
import net.corda.core.internal.cordapp.CordappImpl
|
|
||||||
import net.corda.core.internal.rules.StateContractValidationEnforcementRule
|
import net.corda.core.internal.rules.StateContractValidationEnforcementRule
|
||||||
import net.corda.core.transactions.LedgerTransaction
|
import net.corda.core.transactions.LedgerTransaction
|
||||||
import net.corda.core.utilities.contextLogger
|
import net.corda.core.utilities.contextLogger
|
||||||
@ -37,6 +36,7 @@ class Verifier(val ltx: LedgerTransaction,
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val logger = contextLogger()
|
private val logger = contextLogger()
|
||||||
|
private val disableHashConstraints = System.getProperty("net.corda.node.internal.Verifier.disableHashConstraints")?.toBoolean() ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -339,9 +339,10 @@ class Verifier(val ltx: LedgerTransaction,
|
|||||||
|
|
||||||
val constraintAttachment = AttachmentWithContext(contractAttachment, contract, ltx.networkParameters!!.whitelistedContractImplementations)
|
val constraintAttachment = AttachmentWithContext(contractAttachment, contract, ltx.networkParameters!!.whitelistedContractImplementations)
|
||||||
|
|
||||||
if (!constraint.isSatisfiedBy(constraintAttachment)) {
|
if (disableHashConstraints && constraint is HashAttachmentConstraint)
|
||||||
|
logger.warn("Skipping hash constraints verification.")
|
||||||
|
else if (!constraint.isSatisfiedBy(constraintAttachment))
|
||||||
throw TransactionVerificationException.ContractConstraintRejection(ltx.id, contract)
|
throw TransactionVerificationException.ContractConstraintRejection(ltx.id, contract)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +177,11 @@ open class NodeStartup : NodeStartupLogging {
|
|||||||
logger.info("The Corda node is running in production mode. If this is a developer environment you can set 'devMode=true' in the node.conf file.")
|
logger.info("The Corda node is running in production mode. If this is a developer environment you can set 'devMode=true' in the node.conf file.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val disableHashConstraints = System.getProperty("net.corda.node.internal.Verifier.disableHashConstraints")?.toBoolean() ?: false
|
||||||
|
if (disableHashConstraints) {
|
||||||
|
Node.printWarning("Hash constraints checking has been disabled by the node operator.")
|
||||||
|
}
|
||||||
|
|
||||||
val nodeInfo = node.start()
|
val nodeInfo = node.start()
|
||||||
val loadedCodapps = node.services.cordappProvider.cordapps.filter { it.isLoaded }
|
val loadedCodapps = node.services.cordappProvider.cordapps.filter { it.isLoaded }
|
||||||
logLoadedCorDapps(loadedCodapps)
|
logLoadedCorDapps(loadedCodapps)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user