mirror of
https://github.com/corda/corda.git
synced 2025-06-17 06:38:21 +00:00
Adding createSignature(filteredTransaction) to serviceHub (#1380)
This commit is contained in:
committed by
GitHub
parent
485c2feb83
commit
62c64ace23
@ -85,7 +85,7 @@ class BFTNonValidatingNotaryService(override val services: ServiceHubInternal, c
|
||||
when (response) {
|
||||
is BFTSMaRt.ClusterResponse.Error -> throw NotaryException(response.error)
|
||||
is BFTSMaRt.ClusterResponse.Signatures -> {
|
||||
log.debug("All input states of transaction ${stx.rootHash} have been committed")
|
||||
log.debug("All input states of transaction ${stx.id} have been committed")
|
||||
return response.txSignatures
|
||||
}
|
||||
}
|
||||
@ -139,16 +139,13 @@ class BFTNonValidatingNotaryService(override val services: ServiceHubInternal, c
|
||||
|
||||
fun verifyAndCommitTx(ftx: FilteredTransaction, callerIdentity: Party): BFTSMaRt.ReplicaResponse {
|
||||
return try {
|
||||
val id = ftx.rootHash
|
||||
val id = ftx.id
|
||||
val inputs = ftx.filteredLeaves.inputs
|
||||
|
||||
validateTimeWindow(ftx.filteredLeaves.timeWindow)
|
||||
commitInputStates(inputs, id, callerIdentity)
|
||||
|
||||
log.debug { "Inputs committed successfully, signing $id" }
|
||||
val signableData = SignableData(id, SignatureMetadata(services.myInfo.platformVersion, Crypto.findSignatureScheme(services.notaryIdentityKey).schemeNumberID))
|
||||
val sig = sign(signableData)
|
||||
BFTSMaRt.ReplicaResponse.Signature(sig)
|
||||
BFTSMaRt.ReplicaResponse.Signature(sign(ftx))
|
||||
} catch (e: NotaryException) {
|
||||
log.debug { "Error processing transaction: ${e.error}" }
|
||||
BFTSMaRt.ReplicaResponse.Error(e.error)
|
||||
|
@ -251,8 +251,8 @@ object BFTSMaRt {
|
||||
return services.database.transaction { services.keyManagementService.sign(bytes, services.notaryIdentityKey) }
|
||||
}
|
||||
|
||||
protected fun sign(signableData: SignableData): TransactionSignature {
|
||||
return services.database.transaction { services.keyManagementService.sign(signableData, services.notaryIdentityKey) }
|
||||
protected fun sign(filteredTransaction: FilteredTransaction): TransactionSignature {
|
||||
return services.database.transaction { services.createSignature(filteredTransaction, services.notaryIdentityKey) }
|
||||
}
|
||||
|
||||
// TODO:
|
||||
|
@ -24,7 +24,7 @@ class NonValidatingNotaryFlow(otherSide: Party, service: TrustedAuthorityNotaryS
|
||||
when (it) {
|
||||
is FilteredTransaction -> {
|
||||
it.verify()
|
||||
TransactionParts(it.rootHash, it.filteredLeaves.inputs, it.filteredLeaves.timeWindow)
|
||||
TransactionParts(it.id, it.filteredLeaves.inputs, it.filteredLeaves.timeWindow)
|
||||
}
|
||||
is NotaryChangeWireTransaction -> TransactionParts(it.id, it.inputs, null)
|
||||
else -> {
|
||||
|
Reference in New Issue
Block a user