File tree Expand file tree Collapse file tree 5 files changed +10
-26
lines changed
packages/core-transactions/src Expand file tree Collapse file tree 5 files changed +10
-26
lines changed Original file line number Diff line number Diff line change @@ -83,17 +83,7 @@ export class DelegateResignationTransactionHandler extends TransactionHandler {
8383 pool : TransactionPool . IConnection ,
8484 processor : TransactionPool . IProcessor ,
8585 ) : Promise < boolean > {
86- if ( await this . typeFromSenderAlreadyInPool ( data , pool , processor ) ) {
87- const wallet : State . IWallet = pool . walletManager . findByPublicKey ( data . senderPublicKey ) ;
88- processor . pushError (
89- data ,
90- "ERR_PENDING" ,
91- `Delegate resignation for "${ wallet . getAttribute ( "delegate.username" ) } " already in the pool` ,
92- ) ;
93- return false ;
94- }
95-
96- return true ;
86+ return ! await this . typeFromSenderAlreadyInPool ( data , pool , processor ) ;
9787 }
9888
9989 public async applyToSender (
Original file line number Diff line number Diff line change @@ -96,11 +96,7 @@ export class MultiSignatureTransactionHandler extends TransactionHandler {
9696 pool : TransactionPool . IConnection ,
9797 processor : TransactionPool . IProcessor ,
9898 ) : Promise < boolean > {
99- if ( await this . typeFromSenderAlreadyInPool ( data , pool , processor ) ) {
100- return false ;
101- }
102-
103- return true ;
99+ return ! await this . typeFromSenderAlreadyInPool ( data , pool , processor ) ;
104100 }
105101
106102 public async applyToSender (
Original file line number Diff line number Diff line change @@ -55,11 +55,7 @@ export class SecondSignatureTransactionHandler extends TransactionHandler {
5555 pool : TransactionPool . IConnection ,
5656 processor : TransactionPool . IProcessor ,
5757 ) : Promise < boolean > {
58- if ( await this . typeFromSenderAlreadyInPool ( data , pool , processor ) ) {
59- return false ;
60- }
61-
62- return true ;
58+ return ! await this . typeFromSenderAlreadyInPool ( data , pool , processor ) ;
6359 }
6460
6561 public async applyToSender (
Original file line number Diff line number Diff line change @@ -106,11 +106,7 @@ export class VoteTransactionHandler extends TransactionHandler {
106106 pool : TransactionPool . IConnection ,
107107 processor : TransactionPool . IProcessor ,
108108 ) : Promise < boolean > {
109- if ( await this . typeFromSenderAlreadyInPool ( data , pool , processor ) ) {
110- return false ;
111- }
112-
113- return true ;
109+ return ! await this . typeFromSenderAlreadyInPool ( data , pool , processor ) ;
114110 }
115111
116112 public async applyToSender (
Original file line number Diff line number Diff line change @@ -25,6 +25,12 @@ export interface ITransactionHandler {
2525 apply ( transaction : Interfaces . ITransaction , walletManager : State . IWalletManager ) : Promise < void > ;
2626 revert ( transaction : Interfaces . ITransaction , walletManager : State . IWalletManager ) : Promise < void > ;
2727
28+ /**
29+ * Check if a transaction of this type can enter the pool.
30+ * If `false` is returned to designate that the transaction cannot enter the pool,
31+ * then this method will have called processor.pushError() to give a detailed
32+ * description of the reason.
33+ */
2834 canEnterTransactionPool (
2935 data : Interfaces . ITransactionData ,
3036 pool : TransactionPool . IConnection ,
You can’t perform that action at this time.
0 commit comments