forked from hyperledger/besu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Plugin API] - Simplify plugin transaction selector interface to retu…
…rn object instead of list (hyperledger#5995) Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
- Loading branch information
1 parent
6717b57
commit 64f9dc4
Showing
5 changed files
with
106 additions
and
75 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
54 changes: 54 additions & 0 deletions
54
...er/besu/ethereum/blockcreation/txselection/selectors/AllAcceptingTransactionSelector.java
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright Hyperledger Besu Contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.ethereum.blockcreation.txselection.selectors; | ||
|
||
import org.hyperledger.besu.datatypes.PendingTransaction; | ||
import org.hyperledger.besu.plugin.data.TransactionProcessingResult; | ||
import org.hyperledger.besu.plugin.data.TransactionSelectionResult; | ||
import org.hyperledger.besu.plugin.services.txselection.TransactionSelector; | ||
|
||
/** A TransactionSelector that unconditionally selects all transactions. */ | ||
public class AllAcceptingTransactionSelector implements TransactionSelector { | ||
public static final AllAcceptingTransactionSelector INSTANCE = | ||
new AllAcceptingTransactionSelector(); | ||
|
||
private AllAcceptingTransactionSelector() {} | ||
|
||
/** | ||
* Always selects the transaction in the pre-processing stage. | ||
* | ||
* @param pendingTransaction The transaction to be evaluated. | ||
* @return Always SELECTED. | ||
*/ | ||
@Override | ||
public TransactionSelectionResult evaluateTransactionPreProcessing( | ||
final PendingTransaction pendingTransaction) { | ||
return TransactionSelectionResult.SELECTED; | ||
} | ||
|
||
/** | ||
* Always selects the transaction in the post-processing stage. | ||
* | ||
* @param pendingTransaction The transaction to be evaluated. | ||
* @param processingResult The result of the transaction processing. | ||
* @return Always SELECTED. | ||
*/ | ||
@Override | ||
public TransactionSelectionResult evaluateTransactionPostProcessing( | ||
final PendingTransaction pendingTransaction, | ||
final TransactionProcessingResult processingResult) { | ||
return TransactionSelectionResult.SELECTED; | ||
} | ||
} |
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