mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-16 04:17:25 +00:00
Change the WatchMempool pool to build statistics about risk analysis. Removes the pay-to-pubkey detection which was in there.
This commit is contained in:
@@ -51,7 +51,7 @@ public class DefaultRiskAnalysis implements RiskAnalysis {
|
||||
|
||||
protected final Transaction tx;
|
||||
protected final List<Transaction> dependencies;
|
||||
protected final Wallet wallet;
|
||||
protected final @Nullable Wallet wallet;
|
||||
|
||||
private Transaction nonStandard;
|
||||
protected Transaction nonFinal;
|
||||
@@ -69,17 +69,20 @@ public class DefaultRiskAnalysis implements RiskAnalysis {
|
||||
analyzed = true;
|
||||
|
||||
Result result = analyzeIsFinal();
|
||||
if (result != Result.OK)
|
||||
if (result != null && result != Result.OK)
|
||||
return result;
|
||||
|
||||
return analyzeIsStandard();
|
||||
}
|
||||
|
||||
private Result analyzeIsFinal() {
|
||||
private @Nullable Result analyzeIsFinal() {
|
||||
// Transactions we create ourselves are, by definition, not at risk of double spending against us.
|
||||
if (tx.getConfidence().getSource() == TransactionConfidence.Source.SELF)
|
||||
return Result.OK;
|
||||
|
||||
if (wallet == null)
|
||||
return null;
|
||||
|
||||
final int height = wallet.getLastBlockSeenHeight();
|
||||
final long time = wallet.getLastBlockSeenTimeSecs();
|
||||
// If the transaction has a lock time specified in blocks, we consider that if the tx would become final in the
|
||||
@@ -172,7 +175,7 @@ public class DefaultRiskAnalysis implements RiskAnalysis {
|
||||
private Result analyzeIsStandard() {
|
||||
// The IsStandard rules don't apply on testnet, because they're just a safety mechanism and we don't want to
|
||||
// crush innovation with valueless test coins.
|
||||
if (!wallet.getNetworkParameters().getId().equals(NetworkParameters.ID_MAINNET))
|
||||
if (wallet != null && !wallet.getNetworkParameters().getId().equals(NetworkParameters.ID_MAINNET))
|
||||
return Result.OK;
|
||||
|
||||
RuleViolation ruleViolation = isStandard(tx);
|
||||
|
||||
Reference in New Issue
Block a user