Skip to content

Commit

Permalink
fix(core-transaction-pool): always apply to sender wallet on acceptCh…
Browse files Browse the repository at this point in the history
…ainedBlock (#3594)
  • Loading branch information
deanpress committed Mar 11, 2020
1 parent 34b4ad3 commit 77c9a88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
8 changes: 3 additions & 5 deletions packages/core-transaction-pool/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 77c9a88

Please sign in to comment.