Skip to content

Commit

Permalink
test: enable some BlockChainTests
Browse files Browse the repository at this point in the history
  • Loading branch information
HashEngineering committed Jul 4, 2022
1 parent 6b571af commit 4eb4d6c
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions core/src/test/java/org/bitcoinj/core/BlockChainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void unconnectedBlocks() throws Exception {
assertEquals(chain.getChainHead().getHeader(), b3.cloneAsHeader());
}

@Test @Ignore // need a faster hasher
@Test
public void difficultyTransitions() throws Exception {
// Add a bunch of blocks in a loop until we reach a difficulty transition point. The unit test params have an
// artificially shortened period.
Expand Down Expand Up @@ -232,7 +232,7 @@ public void badDifficulty() throws Exception {
* Test that version 2 blocks are rejected once version 3 blocks are a super
* majority.
*/
@Test @Ignore // need a faster hasher
@Test
public void badBip66Version() throws Exception {
testDeprecatedBlockVersion(Block.BLOCK_VERSION_BIP34, Block.BLOCK_VERSION_BIP66);
}
Expand All @@ -241,7 +241,7 @@ public void badBip66Version() throws Exception {
* Test that version 3 blocks are rejected once version 4 blocks are a super
* majority.
*/
@Test @Ignore // need a faster hasher
@Test
public void badBip65Version() throws Exception {
testDeprecatedBlockVersion(Block.BLOCK_VERSION_BIP66, Block.BLOCK_VERSION_BIP65);
}
Expand Down Expand Up @@ -279,7 +279,7 @@ private void testDeprecatedBlockVersion(final long deprecatedVersion, final long
}
}

@Test @Ignore // need a faster hasher
@Test
public void duplicates() throws Exception {
// Adding a block twice should not have any effect, in particular it should not send the block to the wallet.
Block b1 = UNITTEST.getGenesisBlock().createNextBlock(coinbaseTo);
Expand All @@ -298,7 +298,7 @@ public void duplicates() throws Exception {
assertEquals(b3, block[0].getHeader());
}

@Test @Ignore // need a faster hasher
@Test
public void intraBlockDependencies() throws Exception {
// Covers issue 166 in which transactions that depend on each other inside a block were not always being
// considered relevant.
Expand All @@ -318,7 +318,7 @@ public void intraBlockDependencies() throws Exception {
assertEquals(Coin.ZERO, wallet.getBalance());
}

@Test @Ignore // need a faster hasher
@Test
public void coinbaseTransactionAvailability() throws Exception {
// Check that a coinbase transaction is only available to spend after NetworkParameters.getSpendableCoinbaseDepth() blocks.

Expand All @@ -339,7 +339,7 @@ public void coinbaseTransactionAvailability() throws Exception {

// The coinbase tx is not yet available to spend.
assertEquals(Coin.ZERO, wallet.getBalance());
assertEquals(wallet.getBalance(BalanceType.ESTIMATED), FIFTY_COINS);
assertEquals(wallet.getBalance(BalanceType.ESTIMATED), PREMINE_COINS);
assertTrue(!coinbaseTransaction.isMature());

// Attempt to spend the coinbase - this should fail as the coinbase is not mature yet.
Expand All @@ -359,7 +359,7 @@ public void coinbaseTransactionAvailability() throws Exception {

// Wallet still does not have the coinbase transaction available for spend.
assertEquals(Coin.ZERO, wallet.getBalance());
assertEquals(wallet.getBalance(BalanceType.ESTIMATED), FIFTY_COINS);
assertEquals(wallet.getBalance(BalanceType.ESTIMATED), PREMINE_COINS);

// The coinbase transaction is still not mature.
assertTrue(!coinbaseTransaction.isMature());
Expand All @@ -378,12 +378,12 @@ public void coinbaseTransactionAvailability() throws Exception {
chain.add(b3);

// Wallet now has the coinbase transaction available for spend.
assertEquals(wallet.getBalance(), FIFTY_COINS);
assertEquals(wallet.getBalance(BalanceType.ESTIMATED), FIFTY_COINS);
assertEquals(wallet.getBalance(), PREMINE_COINS);
assertEquals(wallet.getBalance(BalanceType.ESTIMATED), PREMINE_COINS);
assertTrue(coinbaseTransaction.isMature());

// Create a spend with the coinbase BTC to the address in the second wallet - this should now succeed.
Transaction coinbaseSend2 = wallet.createSend(addressToSendTo, valueOf(49, 0));
Transaction coinbaseSend2 = wallet.createSend(addressToSendTo, valueOf(240639, 0));
assertNotNull(coinbaseSend2);

// Commit the coinbaseSpend to the first wallet and check the balances decrement.
Expand All @@ -398,8 +398,8 @@ public void coinbaseTransactionAvailability() throws Exception {
assertEquals(wallet.getBalance(BalanceType.AVAILABLE), COIN);

// Check the balances in the second wallet.
assertEquals(wallet2.getBalance(BalanceType.ESTIMATED), valueOf(49, 0));
assertEquals(wallet2.getBalance(BalanceType.AVAILABLE), valueOf(49, 0));
assertEquals(wallet2.getBalance(BalanceType.ESTIMATED), valueOf(240639, 0));
assertEquals(wallet2.getBalance(BalanceType.AVAILABLE), valueOf(240639, 0));
}

// Some blocks from the test net.
Expand Down Expand Up @@ -462,7 +462,7 @@ public void falsePositives() throws Exception {
assertEquals(rate1, chain.getFalsePositiveRate(), 1e-4);
}

@Test @Ignore // need a faster hasher
@Test
public void rollbackBlockStore() throws Exception {
// This test simulates an issue on Android, that causes the VM to crash while receiving a block, so that the
// block store is persisted but the wallet is not.
Expand Down

0 comments on commit 4eb4d6c

Please sign in to comment.