From 77c9a88ea094add6d224ec7900f5f72fb70b7068 Mon Sep 17 00:00:00 2001 From: Dean van Dugteren <31391056+deanpress@users.noreply.github.com> Date: Wed, 11 Mar 2020 09:09:01 +0100 Subject: [PATCH] fix(core-transaction-pool): always apply to sender wallet on acceptChainedBlock (#3594) --- .../integration/core-transaction-pool/processor.test.ts | 1 + packages/core-transaction-pool/src/connection.ts | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/__tests__/integration/core-transaction-pool/processor.test.ts b/__tests__/integration/core-transaction-pool/processor.test.ts index 80af570165..a81a4f2728 100644 --- a/__tests__/integration/core-transaction-pool/processor.test.ts +++ b/__tests__/integration/core-transaction-pool/processor.test.ts @@ -100,6 +100,7 @@ describe("Transaction Guard", () => { const transaction = TransactionFactory.transfer(walletGen.address, 2 * 100000000) .withNetwork("unitnet") + .withNonce(wallet.nonce.plus(1)) .withPassphrase(walletGen.passphrase) .build()[0]; diff --git a/packages/core-transaction-pool/src/connection.ts b/packages/core-transaction-pool/src/connection.ts index f0170b79ad..504db79c3e 100644 --- a/packages/core-transaction-pool/src/connection.ts +++ b/packages/core-transaction-pool/src/connection.ts @@ -216,16 +216,14 @@ export class Connection implements TransactionPool.IConnection { transaction.typeGroup, ); - const senderWallet: State.IWallet = this.walletManager.hasByPublicKey(senderPublicKey) - ? this.walletManager.findByPublicKey(senderPublicKey) - : undefined; + await transactionHandler.applyToRecipient(transaction, this.walletManager); + + const senderWallet: State.IWallet = this.walletManager.findByPublicKey(senderPublicKey); const recipientWallet: State.IWallet = this.walletManager.hasByAddress(data.recipientId) ? this.walletManager.findByAddress(data.recipientId) : undefined; - await transactionHandler.applyToRecipient(transaction, this.walletManager); - if (exists) { this.removeTransaction(transaction); } else if (senderWallet) {