Skip to content

Commit

Permalink
Remove outpoints from bloom filter when transaction comes in block.
Browse files Browse the repository at this point in the history
  • Loading branch information
omurovch committed Jan 8, 2020
1 parent bbd7902 commit 92b6835
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class TransactionProcessor(
val inserted = mutableListOf<Transaction>()
val updated = mutableListOf<Transaction>()

val pendingExists = storage.getIncomingPendingTxHashes().isNotEmpty() || block == null

// when the same transaction came in merkle block and from another peer's mempool we need to process it serial
synchronized(this) {
for ((index, transaction) in transactions.inTopologicalOrder().withIndex()) {
Expand All @@ -74,6 +76,7 @@ class TransactionProcessor(

if (transactionInDB.blockHash != null) {
transactionInDB.conflictingTxHash = null
needToUpdateBloomFilter = needToUpdateBloomFilter || !transaction.header.isOutgoing
}

storage.updateTransaction(transactionInDB)
Expand Down Expand Up @@ -105,12 +108,13 @@ class TransactionProcessor(


if (!skipCheckBloomFilter) {
val checkDoubleSpend = !transaction.header.isOutgoing && block == null
needToUpdateBloomFilter = needToUpdateBloomFilter ||
!transaction.header.isOutgoing || // need update outpoints for incoming tx to check double spend txs
checkDoubleSpend ||
publicKeyManager.gapShifts() ||
irregularOutputFinder.hasIrregularOutput(transaction.outputs)
}
} else {
} else if (pendingExists) {

processedNotMineTransactions.add(notMineTransaction)

Expand Down

0 comments on commit 92b6835

Please # to comment.