Send a transaction for notarisation only if it has inputs or a timestamp

This commit is contained in:
Andrius Dagys 2017-02-10 10:55:17 +00:00
parent a19dd55257
commit 36052cbd63

View File

@ -84,7 +84,12 @@ class FinalityFlow(val transactions: Iterable<SignedTransaction>,
} }
} }
private fun needsNotarySignature(stx: SignedTransaction) = stx.tx.notary != null && hasNoNotarySignature(stx) private fun needsNotarySignature(stx: SignedTransaction): Boolean {
val wtx = stx.tx
val needsNotarisation = wtx.inputs.isNotEmpty() || wtx.timestamp != null
return needsNotarisation && hasNoNotarySignature(stx)
}
private fun hasNoNotarySignature(stx: SignedTransaction): Boolean { private fun hasNoNotarySignature(stx: SignedTransaction): Boolean {
val notaryKey = stx.tx.notary?.owningKey val notaryKey = stx.tx.notary?.owningKey
val signers = stx.sigs.map { it.by }.toSet() val signers = stx.sigs.map { it.by }.toSet()