-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transaction-pool-service): add senders nonce and balance checks (#…
…716) * Remove throwIfCannotEnterPool * Drop applyToSender&Recipient * Remove throwIfCannotBeApplied super call * Register throwIfCannotBeApplied action * Replace publicKey with address * Set wallet * Use address * Remove applyFeeToSender * Verify nonce * Verify balance * Remove verifyTransactionFee * Apply changes to sender * Remove applyTransaction * style: resolve style guide violations * Move logs to transaction processor * Fix deps * style: resolve style guide violations --------- Co-authored-by: sebastijankuzner <[email protected]>
- Loading branch information
1 parent
eb4c80b
commit e91b157
Showing
22 changed files
with
145 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/contracts/source/contracts/transaction-pool/sender-state.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { Transaction } from "../crypto/transactions.js"; | ||
|
||
export interface SenderState { | ||
configure(publicKey: string): Promise<SenderState>; | ||
configure(address: string): Promise<SenderState>; | ||
apply(transaction: Transaction): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
packages/transaction-pool-service/source/actions/apply-transaction.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export { ApplyTransactionAction } from "./apply-transaction.js"; | ||
export { ThrowIfCannotEnterPoolAction } from "./throw-if-cannot-enter-pool.js"; | ||
export { VerifyTransactionAction } from "./verify-transaction.js"; | ||
export * from "./throw-if-cannot-be-applied.js"; | ||
export * from "./verify-transaction.js"; |
9 changes: 4 additions & 5 deletions
9
...rce/actions/throw-if-cannot-enter-pool.ts → ...rce/actions/throw-if-cannot-be-applied.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
import { Contracts } from "@mainsail/contracts"; | ||
import { Types } from "@mainsail/kernel"; | ||
import { Services, Types } from "@mainsail/kernel"; | ||
|
||
import { TransactionTriggerAction } from "./transaction-trigger-action.js"; | ||
|
||
export class ThrowIfCannotEnterPoolAction extends TransactionTriggerAction { | ||
export class ThrowIfCannotBeAppliedAction extends Services.Triggers.Action { | ||
public async execute(arguments_: Types.ActionArguments): Promise<void> { | ||
const handler: Contracts.Transactions.TransactionHandler = arguments_.handler; | ||
const transaction: Contracts.Crypto.Transaction = arguments_.transaction; | ||
const sender: Contracts.State.Wallet = arguments_.sender; | ||
|
||
return handler.throwIfCannotEnterPool(transaction); | ||
await handler.throwIfCannotBeApplied(transaction, sender); | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
packages/transaction-pool-service/source/actions/transaction-trigger-action.ts
This file was deleted.
Oops, something went wrong.
6 changes: 2 additions & 4 deletions
6
packages/transaction-pool-service/source/actions/verify-transaction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.