mirror of
https://github.com/corda/corda.git
synced 2025-06-17 14:48:16 +00:00
Refactor transaction serialization caching (#1078)
* Cache deserialized rather than serialized WireTransaction. Prevent repeated deserialization when adding signatures to the SignedTransaction. * Added a test to check that stx copying and signature collection still works properly after (de)serialization
This commit is contained in:
@ -605,7 +605,6 @@ class TwoPartyTradeFlowTests {
|
||||
vararg extraSigningNodes: AbstractNode): Map<SecureHash, SignedTransaction> {
|
||||
|
||||
val signed = wtxToSign.map {
|
||||
val bits = it.serialize()
|
||||
val id = it.id
|
||||
val sigs = mutableListOf<DigitalSignature.WithKey>()
|
||||
sigs.add(node.services.keyManagementService.sign(id.bytes, node.services.legalIdentityKey))
|
||||
@ -613,7 +612,7 @@ class TwoPartyTradeFlowTests {
|
||||
extraSigningNodes.forEach { currentNode ->
|
||||
sigs.add(currentNode.services.keyManagementService.sign(id.bytes, currentNode.info.legalIdentity.owningKey))
|
||||
}
|
||||
SignedTransaction(bits, sigs)
|
||||
SignedTransaction(it, sigs)
|
||||
}
|
||||
return node.database.transaction {
|
||||
node.services.recordTransactions(signed)
|
||||
|
@ -214,6 +214,6 @@ class RequeryConfigurationTest : TestDependencyInjectionBase() {
|
||||
type = TransactionType.General,
|
||||
timeWindow = null
|
||||
)
|
||||
return SignedTransaction(wtx.serialized, listOf(DigitalSignature.WithKey(NullPublicKey, ByteArray(1))))
|
||||
return SignedTransaction(wtx, listOf(DigitalSignature.WithKey(NullPublicKey, ByteArray(1))))
|
||||
}
|
||||
}
|
@ -152,6 +152,6 @@ class DBTransactionStorageTests : TestDependencyInjectionBase() {
|
||||
type = TransactionType.General,
|
||||
timeWindow = null
|
||||
)
|
||||
return SignedTransaction(wtx.serialized, listOf(DigitalSignature.WithKey(NullPublicKey, ByteArray(1))))
|
||||
return SignedTransaction(wtx, listOf(DigitalSignature.WithKey(NullPublicKey, ByteArray(1))))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user