mirror of
https://github.com/corda/corda.git
synced 2025-05-30 06:04:24 +00:00
core: Add DummyLinearState and AlwaysSucceedContract for testing
This commit is contained in:
parent
2c7b86fee2
commit
f233780e08
@ -0,0 +1,10 @@
|
|||||||
|
package com.r3corda.core.testing
|
||||||
|
|
||||||
|
import com.r3corda.core.contracts.Contract
|
||||||
|
import com.r3corda.core.contracts.TransactionForContract
|
||||||
|
import com.r3corda.core.crypto.SecureHash
|
||||||
|
|
||||||
|
class AlwaysSucceedContract(override val legalContractReference: SecureHash = SecureHash.sha256("Always succeed contract")) : Contract {
|
||||||
|
override fun verify(tx: TransactionForContract) {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.r3corda.core.testing
|
||||||
|
|
||||||
|
import com.r3corda.core.contracts.Contract
|
||||||
|
import com.r3corda.core.contracts.LinearState
|
||||||
|
import com.r3corda.core.crypto.SecureHash
|
||||||
|
import java.security.PublicKey
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class DummyLinearState(
|
||||||
|
override val thread: SecureHash = SecureHash.randomSHA256(),
|
||||||
|
override val contract: Contract = AlwaysSucceedContract(),
|
||||||
|
override val participants: List<PublicKey> = listOf()) : LinearState {
|
||||||
|
|
||||||
|
override fun isRelevant(ourKeys: Set<PublicKey>): Boolean {
|
||||||
|
return participants.any { ourKeys.contains(it) }
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user