How to use @liskhq/lisk-transaction-pool - 10 common examples

To help you get started, we’ve selected a few @liskhq/lisk-transaction-pool examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiskHQ / lisk-sdk / framework / src / modules / chain / transaction_pool / transaction_pool.js View on Github external
subscribeEvents() {
		this.pool.on(pool.EVENT_ADDED_TRANSACTIONS, ({ action, to, payload }) => {
			if (payload.length > 0) {
				if (action === pool.ACTION_ADD_TRANSACTIONS) {
					payload.forEach(aTransaction =>
						// TODO: make it as a valid event
						this.emit('unconfirmedTransaction', aTransaction)
					);
				}

				this.logger.info(
					`Transaction pool - added transactions ${
						to ? `to ${to} queue` : ''
					} on action: ${action} with ID(s): ${payload.map(
						transaction => transaction.id
					)}`
				);
			}
github LiskHQ / lisk-sdk / framework / src / modules / chain / transaction_pool / transaction_pool.js View on Github external
payload.forEach(aTransaction =>
						// TODO: make it as a valid event
						this.emit('unconfirmedTransaction', aTransaction)
					);
				}

				this.logger.info(
					`Transaction pool - added transactions ${
						to ? `to ${to} queue` : ''
					} on action: ${action} with ID(s): ${payload.map(
						transaction => transaction.id
					)}`
				);
			}
		});
		this.pool.on(pool.EVENT_REMOVED_TRANSACTIONS, ({ action, payload }) => {
			if (payload.length > 0) {
				this.logger.info(
					`Transaction pool - removed transactions on action: ${action} with ID(s): ${payload.map(
						transaction => transaction.id
					)}`
				);
			}
			const queueSizes = Object.keys(this.pool._queues)
				.map(
					queueName =>
						`${queueName} size: ${this.pool._queues[queueName].size()}`
				)
				.join(' ');
			this.logger.info(`Transaction pool - ${queueSizes}`);
		});
	}
github LiskHQ / lisk-sdk / framework / src / modules / chain / transaction_pool / transaction_pool.js View on Github external
this.pool.on(pool.EVENT_ADDED_TRANSACTIONS, ({ action, to, payload }) => {
			if (payload.length > 0) {
				if (action === pool.ACTION_ADD_TRANSACTIONS) {
					payload.forEach(aTransaction =>
						// TODO: make it as a valid event
						this.emit('unconfirmedTransaction', aTransaction)
					);
				}

				this.logger.info(
					`Transaction pool - added transactions ${
						to ? `to ${to} queue` : ''
					} on action: ${action} with ID(s): ${payload.map(
						transaction => transaction.id
					)}`
				);
			}
		});
		this.pool.on(pool.EVENT_REMOVED_TRANSACTIONS, ({ action, payload }) => {
github LiskHQ / lisk-sdk / framework / src / modules / chain / transaction_pool / transaction_pool.js View on Github external
subscribeEvents() {
		this.pool.on(pool.EVENT_VERIFIED_TRANSACTION_ONCE, ({ payload }) => {
			if (payload.length > 0) {
				payload.forEach(aTransaction =>
					this.emit(EVENT_UNCONFIRMED_TRANSACTION, aTransaction),
				);
			}
		});

		this.pool.on(pool.EVENT_ADDED_TRANSACTIONS, ({ action, to, payload }) => {
			if (payload.length > 0) {
				this.logger.info(
					`Transaction pool - added transactions ${
						to ? `to ${to} queue` : ''
					} on action: ${action} with ID(s): ${payload.map(
						transaction => transaction.id,
					)}`,
				);
			}
		});

		this.pool.on(pool.EVENT_REMOVED_TRANSACTIONS, ({ action, payload }) => {
			if (payload.length > 0) {
				this.logger.info(
					`Transaction pool - removed transactions on action: ${action} with ID(s): ${payload.map(
						transaction => transaction.id,
github LiskHQ / lisk-sdk / framework / src / modules / chain / transaction_pool / transaction_pool.js View on Github external
subscribeEvents() {
		this.pool.on(pool.EVENT_VERIFIED_TRANSACTION_ONCE, ({ payload }) => {
			if (payload.length > 0) {
				payload.forEach(aTransaction =>
					this.emit(EVENT_UNCONFIRMED_TRANSACTION, aTransaction),
				);
			}
		});

		this.pool.on(pool.EVENT_ADDED_TRANSACTIONS, ({ action, to, payload }) => {
			if (payload.length > 0) {
				this.logger.info(
					`Transaction pool - added transactions ${
						to ? `to ${to} queue` : ''
					} on action: ${action} with ID(s): ${payload.map(
						transaction => transaction.id,
					)}`,
				);
github LiskHQ / lisk-sdk / framework / src / modules / chain / transaction_pool / transaction_pool.js View on Github external
receivedTransactionsLimitPerProcessing: this.bundleLimit,
			receivedTransactionsProcessingInterval: this.bundledInterval,
			validatedTransactionsLimitPerProcessing: this.bundleLimit,
			validatedTransactionsProcessingInterval: this.bundledInterval,
			verifiedTransactionsLimitPerProcessing: this.maxTransactionsPerBlock,
			verifiedTransactionsProcessingInterval: this.bundledInterval,
			pendingTransactionsProcessingLimit: this.maxTransactionsPerBlock,
		};

		const poolDependencies = {
			validateTransactions: this.validateTransactions,
			verifyTransactions: this.verifyTransactions,
			processTransactions: this.processTransactions,
		};

		this.pool = new pool.TransactionPool({
			...poolConfig,
			...poolDependencies,
		});

		this.subscribeEvents();
	}
github LiskHQ / lisk-sdk / framework / src / modules / chain / logic / transaction_pool.js View on Github external
receivedTransactionsLimitPerProcessing: this.bundleLimit,
			receivedTransactionsProcessingInterval: this.bundledInterval,
			validatedTransactionsLimitPerProcessing: this.bundleLimit,
			validatedTransactionsProcessingInterval: this.bundledInterval,
			verifiedTransactionsLimitPerProcessing: MAX_TRANSACTIONS_PER_BLOCK,
			verifiedTransactionsProcessingInterval: this.bundledInterval,
			pendingTransactionsProcessingLimit: MAX_TRANSACTIONS_PER_BLOCK,
		};

		const poolDependencies = {
			validateTransactions: this.validateTransactions,
			verifyTransactions: this.verifyTransactions,
			processTransactions: this.processTransactions,
		};

		this.pool = new pool.TransactionPool({
			...poolConfig,
			...poolDependencies,
		});

		this.subscribeEvents();
	}
github LiskHQ / lisk-sdk / framework / src / modules / chain / logic / transaction_pool.js View on Github external
receivedTransactionsLimitPerProcessing: this.bundleLimit,
			receivedTransactionsProcessingInterval: this.bundledInterval,
			validatedTransactionsLimitPerProcessing: this.bundleLimit,
			validatedTransactionsProcessingInterval: this.bundledInterval,
			verifiedTransactionsLimitPerProcessing: MAX_TRANSACTIONS_PER_BLOCK,
			verifiedTransactionsProcessingInterval: this.bundledInterval,
			pendingTransactionsProcessingLimit: MAX_TRANSACTIONS_PER_BLOCK,
		};

		const poolDependencies = {
			validateTransactions: this.validateTransactions,
			verifyTransactions: this.verifyTransactions,
			processTransactions: this.processTransactions,
		};

		this.pool = new pool.TransactionPool({
			...poolConfig,
			...poolDependencies,
		});

		this.subscribeEvents();
	}
github LiskHQ / lisk-sdk / framework / src / modules / chain / transaction_pool / transaction_pool.js View on Github external
receivedTransactionsLimitPerProcessing: this.bundleLimit,
			receivedTransactionsProcessingInterval: this.bundledInterval,
			validatedTransactionsLimitPerProcessing: this.bundleLimit,
			validatedTransactionsProcessingInterval: this.bundledInterval,
			verifiedTransactionsLimitPerProcessing: this.maxTransactionsPerBlock,
			verifiedTransactionsProcessingInterval: this.bundledInterval,
			pendingTransactionsProcessingLimit: this.maxTransactionsPerBlock,
		};

		const poolDependencies = {
			validateTransactions: this.validateTransactions,
			verifyTransactions: this.verifyTransactions,
			processTransactions: this.processTransactions,
		};

		this.pool = new pool.TransactionPool({
			...poolConfig,
			...poolDependencies,
		});

		this.subscribeEvents();
	}
github LiskHQ / lisk-sdk / framework / src / modules / chain / transaction_pool / transaction_pool.js View on Github external
receivedTransactionsLimitPerProcessing: this.bundleLimit,
			receivedTransactionsProcessingInterval: this.bundledInterval,
			validatedTransactionsLimitPerProcessing: this.bundleLimit,
			validatedTransactionsProcessingInterval: this.bundledInterval,
			verifiedTransactionsLimitPerProcessing: this.maxTransactionsPerBlock,
			verifiedTransactionsProcessingInterval: this.bundledInterval,
			pendingTransactionsProcessingLimit: this.maxTransactionsPerBlock,
		};

		const poolDependencies = {
			validateTransactions: this.validateTransactions,
			verifyTransactions: this.verifyTransactions,
			processTransactions: this.processTransactions,
		};

		this.pool = new pool.TransactionPool({
			...poolConfig,
			...poolDependencies,
		});

		this.subscribeEvents();
	}