mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-19 05:43:51 +01:00
Multi-threaded DLC CET signature verification (#3176)
This commit is contained in:
parent
604194293c
commit
4b42b90784
@ -59,19 +59,18 @@ case class DLCSignatureVerifier(builder: DLCTxBuilder, isInitiator: Boolean) {
|
||||
val correctNumberOfSigs =
|
||||
sigs.size >= builder.contractInfo.allOutcomes.length
|
||||
|
||||
def runVerify(
|
||||
outcomeSigs: Vector[
|
||||
(Indexed[ECPublicKey], ECAdaptorSignature)]): Future[Boolean] = {
|
||||
Future {
|
||||
outcomeSigs.foldLeft(true) { case (ret, (outcome, sig)) =>
|
||||
ret && verifyCETSig(outcome, sig)
|
||||
val verifyFn: Vector[(Indexed[ECPublicKey], ECAdaptorSignature)] => Future[
|
||||
Boolean] = { outcomeSigs =>
|
||||
FutureUtil.makeAsync { () =>
|
||||
outcomeSigs.forall { case (outcome, sig) =>
|
||||
verifyCETSig(outcome, sig)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (correctNumberOfSigs) {
|
||||
FutureUtil
|
||||
.batchAndParallelExecute(sigs, runVerify, 25)
|
||||
.batchAndParallelExecute(sigs, verifyFn)
|
||||
.map(_.forall(res => res))
|
||||
} else Future.successful(false)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user