Skip to content

Commit

Permalink
Fix duplicated fired events when using PicoConsensus
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffesquivels committed Jan 28, 2020
1 parent eb03abc commit 6dbbd14
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/generic/api/Client.js
Expand Up @@ -268,9 +268,11 @@ class Client {
const revertedTxs = new HashSet();
const adoptedTxs = new HashSet(a => a.tx instanceof Transaction ? a.tx.hash().hashCode() : a.hash().hashCode());

const consensus = await this._consensus;

// Gather reverted transactions
for (const block of revertedBlocks) {
if (block.isFull()) {
if (block.isFull() && !(consensus instanceof PicoConsensus)) {
revertedTxs.addAll(block.transactions);
}
const set = this._transactionConfirmWaiting.get(this._txConfirmsAt(block.height));
Expand All @@ -285,7 +287,7 @@ class Client {
// Gather applied transactions
// Only for full blocks, nano/pico nodes will fire transaction mined events later independently
for (const block of adoptedBlocks) {
if (block.isFull()) {
if (block.isFull() && !(consensus instanceof PicoConsensus)) {
for (const tx of block.transactions) {
if (revertedTxs.contains(tx)) {
revertedTxs.remove(tx);
Expand Down

0 comments on commit 6dbbd14

Please sign in to comment.