Replace wire transaction with signed transaction

This commit is contained in:
lemjclarke 2022-03-08 17:15:04 +00:00
parent 14c38a6fce
commit a9eedd92fd

View File

@ -4,21 +4,24 @@ import net.corda.core.contracts.Attachment
import net.corda.core.contracts.ContractState import net.corda.core.contracts.ContractState
import net.corda.core.contracts.StateAndRef import net.corda.core.contracts.StateAndRef
import net.corda.core.node.NetworkParameters import net.corda.core.node.NetworkParameters
import net.corda.core.serialization.CordaSerializable
import net.corda.core.transactions.SignedTransaction
import net.corda.core.transactions.WireTransaction import net.corda.core.transactions.WireTransaction
/** /**
* Enclave representation of a ledger transaction. * Enclave representation of a signed and ledger transaction.
* ConclaveLedgerTxModel wraps a [WireTransaction] and additional properties to allow an enclave to reconstruct and * ConclaveLedgerTxModel wraps a [SignedTransaction] and additional properties to allow an enclave to reconstruct and
* verify a ledger transaction. * verify a ledger transaction.
* @property wireTransaction a serializable transaction without signatures. * @property signedTransaction a serializable transaction with signatures.
* @property inputStates an array of input states that will be consumed by the wrapped transaction. * @property inputStates an array of input states that will be consumed by the wrapped transaction.
* @property attachments an array of attachment objects that are required for this transaction to verify. * @property attachments an array of attachment objects that are required for this transaction to verify.
* @property networkParameters the network parameters that were in force when the enclosed wire transaction was * @property networkParameters the network parameters that were in force when the enclosed wire transaction was
* constructed. * constructed.
* @property references an array of reference states. * @property references an array of reference states.
*/ */
@CordaSerializable
data class ConclaveLedgerTxModel( data class ConclaveLedgerTxModel(
val wireTransaction: WireTransaction, val signedTransaction: SignedTransaction,
val inputStates: Array<StateAndRef<ContractState>>, val inputStates: Array<StateAndRef<ContractState>>,
val attachments: Array<Attachment>, val attachments: Array<Attachment>,
val networkParameters: NetworkParameters, val networkParameters: NetworkParameters,
@ -30,7 +33,7 @@ data class ConclaveLedgerTxModel(
other as ConclaveLedgerTxModel other as ConclaveLedgerTxModel
if (wireTransaction != other.wireTransaction) return false if (signedTransaction != other.signedTransaction) return false
if (!inputStates.contentEquals(other.inputStates)) return false if (!inputStates.contentEquals(other.inputStates)) return false
if (!attachments.contentEquals(other.attachments)) return false if (!attachments.contentEquals(other.attachments)) return false
if (networkParameters != other.networkParameters) return false if (networkParameters != other.networkParameters) return false
@ -40,7 +43,7 @@ data class ConclaveLedgerTxModel(
} }
override fun hashCode(): Int { override fun hashCode(): Int {
var result = wireTransaction.hashCode() var result = signedTransaction.hashCode()
result = 31 * result + inputStates.contentHashCode() result = 31 * result + inputStates.contentHashCode()
result = 31 * result + attachments.contentHashCode() result = 31 * result + attachments.contentHashCode()
result = 31 * result + networkParameters.hashCode() result = 31 * result + networkParameters.hashCode()