diff --git a/core/src/main/java/org/bitcoinj/testing/FakeTxBuilder.java b/core/src/main/java/org/bitcoinj/testing/FakeTxBuilder.java index 7df92f39a..28a09814f 100644 --- a/core/src/main/java/org/bitcoinj/testing/FakeTxBuilder.java +++ b/core/src/main/java/org/bitcoinj/testing/FakeTxBuilder.java @@ -41,6 +41,7 @@ import org.bitcoinj.script.ScriptBuilder; import org.bitcoinj.store.BlockStore; import org.bitcoinj.store.BlockStoreException; +import javax.annotation.Nullable; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.ByteBuffer; @@ -329,11 +330,10 @@ public class FakeTxBuilder { } public static Block makeSolvedTestBlock(Block prev, Transaction... transactions) throws BlockStoreException { - Address to = randomAddress(prev.getParams()); - return makeSolvedTestBlock(prev, to, transactions); + return makeSolvedTestBlock(prev, null, transactions); } - public static Block makeSolvedTestBlock(Block prev, Address to, Transaction... transactions) throws BlockStoreException { + public static Block makeSolvedTestBlock(Block prev, @Nullable Address to, Transaction... transactions) throws BlockStoreException { Block b = prev.createNextBlock(to); // Coinbase tx already exists. for (Transaction tx : transactions) { diff --git a/integration-test/src/test/java/org/bitcoinj/core/PeerGroupTest.java b/integration-test/src/test/java/org/bitcoinj/core/PeerGroupTest.java index e44e681a1..932f3eda0 100644 --- a/integration-test/src/test/java/org/bitcoinj/core/PeerGroupTest.java +++ b/integration-test/src/test/java/org/bitcoinj/core/PeerGroupTest.java @@ -820,7 +820,7 @@ public class PeerGroupTest extends TestWithPeerGroup { for (ECKey key1 : keys) { Address addr = key1.toAddress(ScriptType.P2PKH, UNITTEST.network()); Block next = FakeTxBuilder.makeSolvedTestBlock(prev, FakeTxBuilder.createFakeTx(UNITTEST, Coin.FIFTY_COINS, addr)); - expectedBalance = expectedBalance.add(next.getTransactions().get(2).getOutput(0).getValue()); + expectedBalance = expectedBalance.add(next.getTransactions().get(1).getOutput(0).getValue()); blocks.add(next); prev = next; }