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 {
83
83
pool : TransactionPool . IConnection ,
84
84
processor : TransactionPool . IProcessor ,
85
85
) : 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 ) ;
97
87
}
98
88
99
89
public async applyToSender (
Original file line number Diff line number Diff line change @@ -96,11 +96,7 @@ export class MultiSignatureTransactionHandler extends TransactionHandler {
96
96
pool : TransactionPool . IConnection ,
97
97
processor : TransactionPool . IProcessor ,
98
98
) : 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 ) ;
104
100
}
105
101
106
102
public async applyToSender (
Original file line number Diff line number Diff line change @@ -55,11 +55,7 @@ export class SecondSignatureTransactionHandler extends TransactionHandler {
55
55
pool : TransactionPool . IConnection ,
56
56
processor : TransactionPool . IProcessor ,
57
57
) : 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 ) ;
63
59
}
64
60
65
61
public async applyToSender (
Original file line number Diff line number Diff line change @@ -106,11 +106,7 @@ export class VoteTransactionHandler extends TransactionHandler {
106
106
pool : TransactionPool . IConnection ,
107
107
processor : TransactionPool . IProcessor ,
108
108
) : 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 ) ;
114
110
}
115
111
116
112
public async applyToSender (
Original file line number Diff line number Diff line change @@ -25,6 +25,12 @@ export interface ITransactionHandler {
25
25
apply ( transaction : Interfaces . ITransaction , walletManager : State . IWalletManager ) : Promise < void > ;
26
26
revert ( transaction : Interfaces . ITransaction , walletManager : State . IWalletManager ) : Promise < void > ;
27
27
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
+ */
28
34
canEnterTransactionPool (
29
35
data : Interfaces . ITransactionData ,
30
36
pool : TransactionPool . IConnection ,
You can’t perform that action at this time.
0 commit comments