diff --git a/core/src/main/java/org/bitcoinj/core/FullPrunedBlockChain.java b/core/src/main/java/org/bitcoinj/core/FullPrunedBlockChain.java index e7b0a822..be5ac276 100644 --- a/core/src/main/java/org/bitcoinj/core/FullPrunedBlockChain.java +++ b/core/src/main/java/org/bitcoinj/core/FullPrunedBlockChain.java @@ -44,10 +44,12 @@ import static com.google.common.base.Preconditions.checkState; * serve the full block chain to other clients, but it nevertheless provides the same security guarantees as a regular * Satoshi client does.

*/ -public class FullPrunedBlockChain extends AbstractBlockChain { +public class FullPrunedBlockChain extends AbstractBlockChain { private static final Logger log = LoggerFactory.getLogger(FullPrunedBlockChain.class); - - /** Keeps a map of block hashes to StoredBlocks. */ + + /** + * Keeps a map of block hashes to StoredBlocks. + */ protected final FullPrunedBlockStore blockStore; // Whether or not to execute scriptPubKeys before accepting a transaction (i.e. check signatures). @@ -70,12 +72,16 @@ public class FullPrunedBlockChain extends AbstractBlockChain { this(Context.getOrCreate(params), wallet, blockStore); } - /** Constructs a block chain connected to the given store. */ + /** + * Constructs a block chain connected to the given store. + */ public FullPrunedBlockChain(Context context, FullPrunedBlockStore blockStore) throws BlockStoreException { this(context, new ArrayList(), blockStore); } - /** See {@link #FullPrunedBlockChain(Context, Wallet, FullPrunedBlockStore)} */ + /** + * See {@link #FullPrunedBlockChain(Context, Wallet, FullPrunedBlockStore)} + */ public FullPrunedBlockChain(NetworkParameters params, FullPrunedBlockStore blockStore) throws BlockStoreException { this(Context.getOrCreate(params), blockStore); } @@ -90,7 +96,9 @@ public class FullPrunedBlockChain extends AbstractBlockChain { this.chainHead = blockStore.getVerifiedChainHead(); } - /** See {@link #FullPrunedBlockChain(Context, List, FullPrunedBlockStore)} */ + /** + * See {@link #FullPrunedBlockChain(Context, List, FullPrunedBlockStore)} + */ public FullPrunedBlockChain(NetworkParameters params, List listeners, FullPrunedBlockStore blockStore) throws BlockStoreException { this(Context.getOrCreate(params), listeners, blockStore); @@ -103,7 +111,7 @@ public class FullPrunedBlockChain extends AbstractBlockChain { blockStore.put(newBlock, new StoredUndoableBlock(newBlock.getHeader().getHash(), txOutChanges)); return newBlock; } - + @Override protected StoredBlock addToBlockStore(StoredBlock storedPrev, Block block) throws BlockStoreException, VerificationException { @@ -132,27 +140,31 @@ public class FullPrunedBlockChain extends AbstractBlockChain { public void setRunScripts(boolean value) { this.runScripts = value; } - - //TODO: Remove lots of duplicated code in the two connectTransactions - + + // TODO: Remove lots of duplicated code in the two connectTransactions + // TODO: execute in order of largest transaction (by input count) first ExecutorService scriptVerificationExecutor = Executors.newFixedThreadPool( Runtime.getRuntime().availableProcessors(), new ContextPropagatingThreadFactory("Script verification")); - /** A job submitted to the executor which verifies signatures. */ + /** + * A job submitted to the executor which verifies signatures. + */ private static class Verifier implements Callable { final Transaction tx; final List