@Test public void standardOutputs() throws Exception { Transaction tx = new Transaction(MAINNET); tx.addInput(MAINNET.getGenesisBlock().getTransactions().get(0).getOutput(0)); tx.addOutput(Coin.CENT, ScriptBuilder.createP2PKHOutputScript(key1)); tx.addOutput(Coin.CENT, ScriptBuilder.createP2PKOutputScript(key1)); tx.addOutput(Coin.CENT, ScriptBuilder.createP2PKOutputScript(key1)); ImmutableList<ECKey> keys = ImmutableList.of(key1, new ECKey()); tx.addOutput(Coin.CENT, ScriptBuilder.createMultiSigOutputScript(1, keys)); tx.addOutput(Coin.CENT, ScriptBuilder.createMultiSigOutputScript(2, keys)); tx.addOutput(Coin.CENT, ScriptBuilder.createP2SHOutputScript(1, keys)); tx.addOutput(Coin.CENT, ScriptBuilder.createOpReturnScript("hi there".getBytes())); assertEquals(RiskAnalysis.Result.OK, DefaultRiskAnalysis.FACTORY.create(wallet, tx, NO_DEPS).analyze()); }
@Override public Result analyze() { checkState(!analyzed); analyzed = true; Result result = analyzeIsFinal(); if (result != null && result != Result.OK) return result; return analyzeIsStandard(); }
DefaultRiskAnalysis implements RiskAnalysis { @Override public Result analyze() { checkState(!analyzed); analyzed = true; Result result = analyzeIsFinal(); if (result != null && result != Result.OK) return result; return analyzeIsStandard(); } }
DefaultRiskAnalysis implements RiskAnalysis { @Override public Result analyze() { checkState(!analyzed); analyzed = true; Result result = analyzeIsFinal(); if (result != null && result != Result.OK) return result; return analyzeIsStandard(); } private  DefaultRiskAnalysis(Wallet wallet, Transaction tx, List<Transaction> dependencies); }
DefaultRiskAnalysis implements RiskAnalysis { @Override public Result analyze() { checkState(!analyzed); analyzed = true; Result result = analyzeIsFinal(); if (result != null && result != Result.OK) return result; return analyzeIsStandard(); } private  DefaultRiskAnalysis(Wallet wallet, Transaction tx, List<Transaction> dependencies); @Override Result analyze(); static RuleViolation isStandard(Transaction tx); static RuleViolation isOutputStandard(TransactionOutput output); static RuleViolation isInputStandard(TransactionInput input); @Nullable Transaction getNonStandard(); @Nullable Transaction getNonFinal(); @Override String toString(); }
DefaultRiskAnalysis implements RiskAnalysis { @Override public Result analyze() { checkState(!analyzed); analyzed = true; Result result = analyzeIsFinal(); if (result != null && result != Result.OK) return result; return analyzeIsStandard(); } private  DefaultRiskAnalysis(Wallet wallet, Transaction tx, List<Transaction> dependencies); @Override Result analyze(); static RuleViolation isStandard(Transaction tx); static RuleViolation isOutputStandard(TransactionOutput output); static RuleViolation isInputStandard(TransactionInput input); @Nullable Transaction getNonStandard(); @Nullable Transaction getNonFinal(); @Override String toString(); static Analyzer FACTORY; }