Commit 062602a7 authored by Cédric Moreau's avatar Cédric Moreau

[fix] #1277 Remove txs from the pool once included in our submitted block

parent 62a7d6c1
import { IdentityForRequirements } from './BlockchainService';
"use strict";
import {IdentityForRequirements} from './BlockchainService';
import {Server} from "../../server"
import {GlobalFifoPromise} from "./GlobalFifoPromise"
import {BlockchainContext} from "../lib/computation/BlockchainContext"
......@@ -7,7 +6,6 @@ import {ConfDTO} from "../lib/dto/ConfDTO"
import {FileDAL} from "../lib/dal/fileDAL"
import {QuickSynchronizer} from "../lib/computation/QuickSync"
import {BlockDTO} from "../lib/dto/BlockDTO"
import {DBIdentity} from "../lib/dal/sqliteDAL/IdentityDAL"
import {DBBlock} from "../lib/db/DBBlock"
import {GLOBAL_RULES_HELPERS} from "../lib/rules/global_rules"
import {parsers} from "../lib/common-libs/parsers/index"
......@@ -18,6 +16,8 @@ import {LOCAL_RULES_FUNCTIONS} from "../lib/rules/local_rules"
import {Switcher, SwitcherDao} from "../lib/blockchain/Switcher"
import {OtherConstants} from "../lib/other_constants"
"use strict";
const _ = require('underscore');
const constants = require('../lib/constants');
......@@ -206,6 +206,11 @@ export class BlockchainService extends FIFOService {
while (!added && i < potentials.length) {
const dto = BlockDTO.fromJSONObject(potentials[i])
try {
if (dto.issuer === this.conf.pair.pub) {
for (const tx of dto.transactions) {
await this.dal.removeTxByHash(tx.hash);
}
}
const addedBlock = await this.mainContext.checkAndAddBlock(dto)
added = true
this.push({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment