mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-03 10:46:42 +01:00
Fetch findByFundingTxId/findByFundingOutPoints in parallel as an optimization (#4560)
This commit is contained in:
parent
191df09196
commit
ba396f2fb3
1 changed files with 5 additions and 4 deletions
|
@ -243,6 +243,7 @@ private[bitcoins] trait DLCTransactionProcessing extends TransactionProcessing {
|
||||||
newTags: Vector[AddressTag],
|
newTags: Vector[AddressTag],
|
||||||
relevantReceivedOutputs: Vector[OutputWithIndex]): Future[
|
relevantReceivedOutputs: Vector[OutputWithIndex]): Future[
|
||||||
Vector[SpendingInfoDb]] = {
|
Vector[SpendingInfoDb]] = {
|
||||||
|
val dlcDbsF = dlcDAO.findByFundingTxId(tx.txIdBE)
|
||||||
super
|
super
|
||||||
.processReceivedUtxos(tx,
|
.processReceivedUtxos(tx,
|
||||||
blockHashOpt,
|
blockHashOpt,
|
||||||
|
@ -251,7 +252,7 @@ private[bitcoins] trait DLCTransactionProcessing extends TransactionProcessing {
|
||||||
relevantReceivedOutputs)
|
relevantReceivedOutputs)
|
||||||
.flatMap { res =>
|
.flatMap { res =>
|
||||||
for {
|
for {
|
||||||
dlcDbs <- dlcDAO.findByFundingTxId(tx.txIdBE)
|
dlcDbs <- dlcDbsF
|
||||||
_ <-
|
_ <-
|
||||||
if (dlcDbs.nonEmpty) {
|
if (dlcDbs.nonEmpty) {
|
||||||
logger.info(
|
logger.info(
|
||||||
|
@ -314,13 +315,13 @@ private[bitcoins] trait DLCTransactionProcessing extends TransactionProcessing {
|
||||||
outputsBeingSpent: Vector[SpendingInfoDb],
|
outputsBeingSpent: Vector[SpendingInfoDb],
|
||||||
blockHashOpt: Option[DoubleSha256DigestBE]): Future[
|
blockHashOpt: Option[DoubleSha256DigestBE]): Future[
|
||||||
Vector[SpendingInfoDb]] = {
|
Vector[SpendingInfoDb]] = {
|
||||||
|
val outPoints = transaction.inputs.map(_.previousOutput).toVector
|
||||||
|
val dlcDbsF = dlcDAO.findByFundingOutPoints(outPoints)
|
||||||
super
|
super
|
||||||
.processSpentUtxos(transaction, outputsBeingSpent, blockHashOpt)
|
.processSpentUtxos(transaction, outputsBeingSpent, blockHashOpt)
|
||||||
.flatMap { res =>
|
.flatMap { res =>
|
||||||
val outPoints = transaction.inputs.map(_.previousOutput).toVector
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
dlcDbs <- dlcDAO.findByFundingOutPoints(outPoints)
|
dlcDbs <- dlcDbsF
|
||||||
_ <-
|
_ <-
|
||||||
if (dlcDbs.nonEmpty) {
|
if (dlcDbs.nonEmpty) {
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
Loading…
Add table
Reference in a new issue