mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 21:32:35 +01:00
FakeTxBuilder: don't create unnecessary transaction in makeSolvedTestBlock()
This commit is contained in:
parent
16da4f8ccf
commit
c309994e99
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user