test_class.declarator: thrown = ExpectedException.none()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public ExpectedException thrown = ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: thrown
test_class.declarator: testNetChain
test_class.modifier: private
test_class.original_string: private BlockChain testNetChain;
test_class.type: BlockChain
test_class.var_name: testNetChain
test_class.declarator: wallet
test_class.modifier: private
test_class.original_string: private Wallet wallet;
test_class.type: Wallet
test_class.var_name: wallet
test_class.declarator: chain
test_class.modifier: private
test_class.original_string: private BlockChain chain;
test_class.type: BlockChain
test_class.var_name: chain
test_class.declarator: blockStore
test_class.modifier: private
test_class.original_string: private BlockStore blockStore;
test_class.type: BlockStore
test_class.var_name: blockStore
test_class.declarator: coinbaseTo
test_class.modifier: private
test_class.original_string: private Address coinbaseTo;
test_class.type: Address
test_class.var_name: coinbaseTo
test_class.declarator: block = new StoredBlock[1]
test_class.modifier: private final
test_class.original_string: private final StoredBlock[] block = new StoredBlock[1];
test_class.type: StoredBlock[]
test_class.var_name: block
test_class.declarator: coinbaseTransaction
test_class.modifier: private
test_class.original_string: private Transaction coinbaseTransaction;
test_class.type: Transaction
test_class.var_name: coinbaseTransaction
test_class.declarator: TESTNET = new TweakableTestNet3Params()
test_class.modifier: private static final
test_class.original_string: private static final TweakableTestNet3Params TESTNET = new TweakableTestNet3Params();
test_class.type: TweakableTestNet3Params
test_class.var_name: TESTNET
test_class.declarator: UNITTEST = UnitTestParams.get()
test_class.modifier: private static final
test_class.original_string: private static final NetworkParameters UNITTEST = UnitTestParams.get();
test_class.type: NetworkParameters
test_class.var_name: UNITTEST
test_class.declarator: MAINNET = MainNetParams.get()
test_class.modifier: private static final
test_class.original_string: private static final NetworkParameters MAINNET = MainNetParams.get();
test_class.type: NetworkParameters
test_class.var_name: MAINNET
test_class.file: core/src/test/java/org/ulordj/core/BlockChainTest.java
test_class.identifier: BlockChainTest
test_case.body: @Test
      public void badDifficulty() throws Exception {
          assertTrue(testNetChain.add(getBlock1()));
          Block b2 = getBlock2();
          assertTrue(testNetChain.add(b2));
          Block bad = new Block(TESTNET, Block.BLOCK_VERSION_GENESIS);
          // Merkle root can be anything here, doesn't matter.
          bad.setMerkleRoot(Sha256Hash.wrap("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
          // Nonce was just some number that made the hash < difficulty limit set below, it can be anything.
          bad.setNonce(BigInteger.valueOf(140548933));
          bad.setTime(1279242649);
          bad.setPrevBlockHash(b2.getHash());
          // We're going to make this block so easy 50% of solutions will pass, and check it gets rejected for having a
          // bad difficulty target. Unfortunately the encoding mechanism means we cannot make one that accepts all
          // solutions.
          bad.setDifficultyTarget(Block.EASIEST_DIFFICULTY_TARGET);
          try {
              testNetChain.add(bad);
              // The difficulty target above should be rejected on the grounds of being easier than the networks
              // allowable difficulty.
              fail();
          } catch (VerificationException e) {
              assertTrue(e.getMessage(), e.getCause().getMessage().contains("Difficulty target is bad"));
          }
  
          // Accept any level of difficulty now.
          BigInteger oldVal = TESTNET.getMaxTarget();
          TESTNET.setMaxTarget(new BigInteger("00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16));
          try {
              testNetChain.add(bad);
              // We should not get here as the difficulty target should not be changing at this point.
              fail();
          } catch (VerificationException e) {
              assertTrue(e.getMessage(), e.getCause().getMessage().contains("Unexpected change in difficulty"));
          }
          TESTNET.setMaxTarget(oldVal);
  
          // TODO: Test difficulty change is not out of range when a transition period becomes valid.
      }
test_case.class_method_signature: BlockChainTest.badDifficulty()
test_case.full_signature: @Test public void badDifficulty()
test_case.identifier: badDifficulty
test_case.invocations: assertTrue add getBlock1 getBlock2 assertTrue add setMerkleRoot wrap setNonce valueOf setTime setPrevBlockHash getHash setDifficultyTarget add fail assertTrue getMessage contains getMessage getCause getMaxTarget setMaxTarget add fail assertTrue getMessage contains getMessage getCause setMaxTarget
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void badDifficulty()
focal_class.declarator: blockStore
focal_class.modifier: protected final
focal_class.original_string: protected final BlockStore blockStore;
focal_class.type: BlockStore
focal_class.var_name: blockStore
focal_class.file: core/src/main/java/org/ulordj/core/BlockChain.java
focal_class.identifier: BlockChain
focal_class.class_method_signature: BlockChain.BlockChain(Context context, Wallet wallet, BlockStore blockStore)
focal_class.full_signature: public  BlockChain(Context context, Wallet wallet, BlockStore blockStore)
focal_class.identifier: BlockChain
focal_class.modifiers: public
focal_class.parameters: (Context context, Wallet wallet, BlockStore blockStore)
focal_class.signature:  BlockChain(Context context, Wallet wallet, BlockStore blockStore)
focal_class.class_method_signature: BlockChain.BlockChain(NetworkParameters params, Wallet wallet, BlockStore blockStore)
focal_class.full_signature: public  BlockChain(NetworkParameters params, Wallet wallet, BlockStore blockStore)
focal_class.identifier: BlockChain
focal_class.modifiers: public
focal_class.parameters: (NetworkParameters params, Wallet wallet, BlockStore blockStore)
focal_class.signature:  BlockChain(NetworkParameters params, Wallet wallet, BlockStore blockStore)
focal_class.class_method_signature: BlockChain.BlockChain(Context context, BlockStore blockStore)
focal_class.full_signature: public  BlockChain(Context context, BlockStore blockStore)
focal_class.identifier: BlockChain
focal_class.modifiers: public
focal_class.parameters: (Context context, BlockStore blockStore)
focal_class.signature:  BlockChain(Context context, BlockStore blockStore)
focal_class.class_method_signature: BlockChain.BlockChain(NetworkParameters params, BlockStore blockStore)
focal_class.full_signature: public  BlockChain(NetworkParameters params, BlockStore blockStore)
focal_class.identifier: BlockChain
focal_class.modifiers: public
focal_class.parameters: (NetworkParameters params, BlockStore blockStore)
focal_class.signature:  BlockChain(NetworkParameters params, BlockStore blockStore)
focal_class.class_method_signature: BlockChain.BlockChain(Context params, List<? extends Wallet> wallets, BlockStore blockStore)
focal_class.full_signature: public  BlockChain(Context params, List<? extends Wallet> wallets, BlockStore blockStore)
focal_class.identifier: BlockChain
focal_class.modifiers: public
focal_class.parameters: (Context params, List<? extends Wallet> wallets, BlockStore blockStore)
focal_class.signature:  BlockChain(Context params, List<? extends Wallet> wallets, BlockStore blockStore)
focal_class.class_method_signature: BlockChain.BlockChain(NetworkParameters params, List<? extends Wallet> wallets, BlockStore blockStore)
focal_class.full_signature: public  BlockChain(NetworkParameters params, List<? extends Wallet> wallets, BlockStore blockStore)
focal_class.identifier: BlockChain
focal_class.modifiers: public
focal_class.parameters: (NetworkParameters params, List<? extends Wallet> wallets, BlockStore blockStore)
focal_class.signature:  BlockChain(NetworkParameters params, List<? extends Wallet> wallets, BlockStore blockStore)
focal_class.class_method_signature: BlockChain.addToBlockStore(StoredBlock storedPrev, Block blockHeader, TransactionOutputChanges txOutChanges)
focal_class.full_signature: @Override protected StoredBlock addToBlockStore(StoredBlock storedPrev, Block blockHeader, TransactionOutputChanges txOutChanges)
focal_class.identifier: addToBlockStore
focal_class.modifiers: @Override protected
focal_class.parameters: (StoredBlock storedPrev, Block blockHeader, TransactionOutputChanges txOutChanges)
focal_class.return: StoredBlock
focal_class.signature: StoredBlock addToBlockStore(StoredBlock storedPrev, Block blockHeader, TransactionOutputChanges txOutChanges)
focal_class.class_method_signature: BlockChain.addToBlockStore(StoredBlock storedPrev, Block blockHeader)
focal_class.full_signature: @Override protected StoredBlock addToBlockStore(StoredBlock storedPrev, Block blockHeader)
focal_class.identifier: addToBlockStore
focal_class.modifiers: @Override protected
focal_class.parameters: (StoredBlock storedPrev, Block blockHeader)
focal_class.return: StoredBlock
focal_class.signature: StoredBlock addToBlockStore(StoredBlock storedPrev, Block blockHeader)
focal_class.class_method_signature: BlockChain.rollbackBlockStore(int height)
focal_class.full_signature: @Override protected void rollbackBlockStore(int height)
focal_class.identifier: rollbackBlockStore
focal_class.modifiers: @Override protected
focal_class.parameters: (int height)
focal_class.return: void
focal_class.signature: void rollbackBlockStore(int height)
focal_class.class_method_signature: BlockChain.shouldVerifyTransactions()
focal_class.full_signature: @Override protected boolean shouldVerifyTransactions()
focal_class.identifier: shouldVerifyTransactions
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean shouldVerifyTransactions()
focal_class.class_method_signature: BlockChain.connectTransactions(int height, Block block)
focal_class.full_signature: @Override protected TransactionOutputChanges connectTransactions(int height, Block block)
focal_class.identifier: connectTransactions
focal_class.modifiers: @Override protected
focal_class.parameters: (int height, Block block)
focal_class.return: TransactionOutputChanges
focal_class.signature: TransactionOutputChanges connectTransactions(int height, Block block)
focal_class.class_method_signature: BlockChain.connectTransactions(StoredBlock newBlock)
focal_class.full_signature: @Override protected TransactionOutputChanges connectTransactions(StoredBlock newBlock)
focal_class.identifier: connectTransactions
focal_class.modifiers: @Override protected
focal_class.parameters: (StoredBlock newBlock)
focal_class.return: TransactionOutputChanges
focal_class.signature: TransactionOutputChanges connectTransactions(StoredBlock newBlock)
focal_class.class_method_signature: BlockChain.disconnectTransactions(StoredBlock block)
focal_class.full_signature: @Override protected void disconnectTransactions(StoredBlock block)
focal_class.identifier: disconnectTransactions
focal_class.modifiers: @Override protected
focal_class.parameters: (StoredBlock block)
focal_class.return: void
focal_class.signature: void disconnectTransactions(StoredBlock block)
focal_class.class_method_signature: BlockChain.doSetChainHead(StoredBlock chainHead)
focal_class.full_signature: @Override protected void doSetChainHead(StoredBlock chainHead)
focal_class.identifier: doSetChainHead
focal_class.modifiers: @Override protected
focal_class.parameters: (StoredBlock chainHead)
focal_class.return: void
focal_class.signature: void doSetChainHead(StoredBlock chainHead)
focal_class.class_method_signature: BlockChain.notSettingChainHead()
focal_class.full_signature: @Override protected void notSettingChainHead()
focal_class.identifier: notSettingChainHead
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void notSettingChainHead()
focal_class.class_method_signature: BlockChain.getStoredBlockInCurrentScope(Sha256Hash hash)
focal_class.full_signature: @Override protected StoredBlock getStoredBlockInCurrentScope(Sha256Hash hash)
focal_class.identifier: getStoredBlockInCurrentScope
focal_class.modifiers: @Override protected
focal_class.parameters: (Sha256Hash hash)
focal_class.return: StoredBlock
focal_class.signature: StoredBlock getStoredBlockInCurrentScope(Sha256Hash hash)
focal_class.class_method_signature: BlockChain.add(FilteredBlock block)
focal_class.full_signature: @Override public boolean add(FilteredBlock block)
focal_class.identifier: add
focal_class.modifiers: @Override public
focal_class.parameters: (FilteredBlock block)
focal_class.return: boolean
focal_class.signature: boolean add(FilteredBlock block)
focal_class.superclass: extends AbstractBlockChain
focal_method.body: @Override
      public boolean add(FilteredBlock block) throws VerificationException, PrunedException {
          boolean success = super.add(block);
          if (success) {
              trackFilteredTransactions(block.getTransactionCount());
          }
          return success;
      }
focal_method.class_method_signature: BlockChain.add(FilteredBlock block)
focal_method.full_signature: @Override public boolean add(FilteredBlock block)
focal_method.identifier: add
focal_method.invocations: add trackFilteredTransactions getTransactionCount
focal_method.modifiers: @Override public
focal_method.parameters: (FilteredBlock block)
focal_method.return: boolean
focal_method.signature: boolean add(FilteredBlock block)