Context: remove useless Context instantiations from a few tests

This commit is contained in:
Andreas Schildbach 2022-06-24 11:00:49 +02:00
parent 76c8d71e44
commit bd002594eb
8 changed files with 1 additions and 19 deletions

View File

@ -68,8 +68,6 @@ public class BitcoindComparisonTool {
System.out.println("USAGE: bitcoinjBlockStoreLocation runExpensiveTests(1/0) [port=18444]");
boolean runExpensiveTests = args.length > 1 && Integer.parseInt(args[1]) == 1;
Context ctx = new Context(PARAMS);
File blockFile = File.createTempFile("testBlocks", ".dat");
blockFile.deleteOnExit();

View File

@ -59,7 +59,6 @@ public class BlockTest {
@Before
public void setUp() throws Exception {
new Context(TESTNET);
// One with some of transactions in, so a good test of the merkle tree hashing.
block700000Bytes = ByteStreams.toByteArray(BlockTest.class.getResourceAsStream("block_testnet700000.dat"));
block700000 = TESTNET.getDefaultSerializer().makeBlock(block700000Bytes);

View File

@ -75,7 +75,6 @@ public class TransactionTest {
@Before
public void setUp() {
Context context = new Context(UNITTEST);
tx = FakeTxBuilder.createFakeTx(UNITTEST);
}

View File

@ -21,7 +21,6 @@ import com.google.protobuf.ByteString;
import org.bitcoin.protocols.payments.Protos;
import org.bitcoinj.core.Address;
import org.bitcoinj.base.Coin;
import org.bitcoinj.core.Context;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.LegacyAddress;
import org.bitcoinj.core.NetworkParameters;
@ -67,7 +66,6 @@ public class PaymentSessionTest {
@Before
public void setUp() {
new Context(TESTNET);
serverKey = new ECKey();
tx = new Transaction(TESTNET);
outputToMe = new TransactionOutput(TESTNET, tx, amount, serverKey);

View File

@ -24,7 +24,6 @@ import com.google.common.collect.Lists;
import org.bitcoinj.base.utils.ByteUtils;
import org.bitcoinj.core.Address;
import org.bitcoinj.base.Coin;
import org.bitcoinj.core.Context;
import org.bitcoinj.core.DumpedPrivateKey;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.LegacyAddress;
@ -45,7 +44,6 @@ import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.params.TestNet3Params;
import org.bitcoinj.script.Script.VerifyFlag;
import org.hamcrest.core.IsNot;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -88,11 +86,6 @@ public class ScriptTest {
private static final Logger log = LoggerFactory.getLogger(ScriptTest.class);
@Before
public void setUp() {
Context context = new Context(TESTNET);
}
@Test
public void testScriptSig() {
byte[] sigProgBytes = HEX.decode(sigProg);

View File

@ -26,7 +26,6 @@ import org.bitcoinj.core.Block;
import org.bitcoinj.core.BlockChain;
import org.bitcoinj.core.BlockTest;
import org.bitcoinj.base.Coin;
import org.bitcoinj.core.Context;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.LegacyAddress;
import org.bitcoinj.core.NetworkParameters;
@ -103,7 +102,6 @@ public class WalletProtobufSerializerTest {
@Before
public void setUp() {
BriefLogFormatter.initVerbose();
Context ctx = new Context(UNITTEST);
myWatchedKey = new ECKey();
myKey = new ECKey();
myKey.setCreationTimeSeconds(123456789L);

View File

@ -17,7 +17,6 @@
package org.bitcoinj.utils;
import org.bitcoinj.core.BlockChain;
import org.bitcoinj.core.Context;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.StoredBlock;
import org.bitcoinj.core.Utils;
@ -48,7 +47,6 @@ public class VersionTallyTest {
@Before
public void setUp() {
BriefLogFormatter.initVerbose();
Context context = new Context(UNITTEST);
}
/**

View File

@ -39,8 +39,7 @@ public class BlockImporter {
params = TestNet3Params.get();
else
params = MainNetParams.get();
new Context(params);
BlockStore store;
if (args[1].equals("H2")) {
Preconditions.checkArgument(args.length == 3);