-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signature cache #1876
Signature cache #1876
Changes from all commits
48562de
264468d
895cfe6
a4077c2
10fcc4f
6183c66
3a2b311
555a296
ad3d0f5
fecacc0
72dbb54
9fcf45e
1328fac
5570526
f9ef510
a0143af
3ef3d1f
8f0b544
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package co.rsk.mine; | ||
|
||
import co.rsk.bitcoinj.core.BtcTransaction; | ||
|
@@ -32,6 +31,7 @@ | |
import org.bouncycastle.util.Arrays; | ||
import org.ethereum.config.blockchain.upgrades.ActivationConfig; | ||
import org.ethereum.config.blockchain.upgrades.ConsensusRule; | ||
import org.ethereum.core.SignatureCache; | ||
import org.ethereum.core.Transaction; | ||
import org.ethereum.core.TransactionPool; | ||
import org.slf4j.Logger; | ||
|
@@ -48,7 +48,6 @@ | |
import java.util.function.Function; | ||
|
||
public class MinerUtils { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger("minerserver"); | ||
|
||
public static co.rsk.bitcoinj.core.BtcTransaction getBitcoinMergedMiningCoinbaseTransaction(co.rsk.bitcoinj.core.NetworkParameters params, MinerWork work) { | ||
|
@@ -163,21 +162,21 @@ public static byte[] buildMerkleProof( | |
} | ||
} | ||
|
||
public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool) { | ||
public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool, SignatureCache signatureCache) { | ||
|
||
List<Transaction> txs = transactionPool.getPendingTransactions(); | ||
|
||
return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs); | ||
return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs, signatureCache); | ||
} | ||
|
||
public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice, boolean isRskip252Enabled) { | ||
public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice, boolean isRskip252Enabled, SignatureCache signatureCache) { | ||
List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); | ||
for (org.ethereum.core.Transaction tx : txs) { | ||
try { | ||
Keccak256 hash = tx.getHash(); | ||
Coin txValue = tx.getValue(); | ||
BigInteger txNonce = new BigInteger(1, tx.getNonce()); | ||
RskAddress txSender = tx.getSender(); | ||
RskAddress txSender = tx.getSender(signatureCache); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will update this as requested. 💪🏼 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated! |
||
logger.debug("Examining tx={} sender: {} value: {} nonce: {}", hash, txSender, txValue, txNonce); | ||
|
||
BigInteger expectedNonce; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this method be static?