Package org.bitcoinj.testing
Class FakeTxBuilder
- java.lang.Object
-
- org.bitcoinj.testing.FakeTxBuilder
-
public class FakeTxBuilder extends java.lang.Object
Methods for building fake transactions for unit tests. Since these methods are currently used both in the `bitcoinj-core` unit tests and in the `integration-test` subproject, they are (for now) included in the `bitcoinj-core` JAR. They should not be considered part of the API.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FakeTxBuilder.BlockPair
static class
FakeTxBuilder.DoubleSpends
-
Constructor Summary
Constructors Constructor Description FakeTxBuilder()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static FakeTxBuilder.BlockPair
createFakeBlock(BlockStore blockStore, int height, Transaction... transactions)
Emulates receiving a valid block that builds on top of the chain.static FakeTxBuilder.BlockPair
createFakeBlock(BlockStore blockStore, long version, long timeSecs, int height, Transaction... transactions)
Deprecated.static FakeTxBuilder.BlockPair
createFakeBlock(BlockStore blockStore, long version, long timeSecs, Transaction... transactions)
Deprecated.static FakeTxBuilder.BlockPair
createFakeBlock(BlockStore blockStore, long version, java.time.Instant time, int height, Transaction... transactions)
Emulates receiving a valid block that builds on top of the chain.static FakeTxBuilder.BlockPair
createFakeBlock(BlockStore blockStore, long version, java.time.Instant time, Transaction... transactions)
Emulates receiving a valid block that builds on top of the chain.static FakeTxBuilder.BlockPair
createFakeBlock(BlockStore blockStore, StoredBlock previousStoredBlock, int height, Transaction... transactions)
static FakeTxBuilder.BlockPair
createFakeBlock(BlockStore blockStore, StoredBlock previousStoredBlock, long version, long timeSecs, int height, Transaction... transactions)
static FakeTxBuilder.BlockPair
createFakeBlock(BlockStore blockStore, StoredBlock previousStoredBlock, long version, java.time.Instant time, int height, Transaction... transactions)
Emulates receiving a valid blockstatic FakeTxBuilder.BlockPair
createFakeBlock(BlockStore blockStore, Transaction... transactions)
Emulates receiving a valid block that builds on top of the chain.static Transaction
createFakeCoinbaseTx()
Create a fake coinbase transaction.static FakeTxBuilder.DoubleSpends
createFakeDoubleSpendTxns(Address to)
Creates two transactions that spend the same (fake) output.static Transaction[]
createFakeTx(Coin value, Address to, Address from)
Transaction[0] is a feeder transaction, supplying BTC to Transaction[1]static Transaction
createFakeTx(Coin value, ECKey to)
Create a fake TX of sufficient realism to exercise the unit tests.static Transaction
createFakeTx(Network network)
Create a fake transaction, without change.static Transaction
createFakeTx(Network network, Coin value, Address to)
Create a fake TX of sufficient realism to exercise the unit tests.static Transaction
createFakeTx(NetworkParameters params)
Deprecated.static Transaction
createFakeTx(NetworkParameters params, Coin value, Address to)
Deprecated.static Transaction
createFakeTxWithChangeAddress(Coin value, Address to, Address changeOutput)
Create a fake TX of sufficient realism to exercise the unit tests.static Transaction
createFakeTxWithoutChange(TransactionOutput output)
Create a fake transaction, without change.static Transaction
createFakeTxWithoutChangeAddress(Coin value, Address to)
Create a fake TX for unit tests, for use with unit tests that need greater control.static Block
makeSolvedTestBlock(Block prev, Address to, Transaction... transactions)
static Block
makeSolvedTestBlock(Block prev, Transaction... transactions)
static Block
makeSolvedTestBlock(BlockStore blockStore, Address coinsTo)
static Transaction
roundTripTransaction(Transaction tx)
Roundtrip a transaction so that it appears as if it has just come from the wire
-
-
-
Method Detail
-
createFakeTx
public static Transaction createFakeTx(Network network)
Create a fake transaction, without change.
-
createFakeTx
@Deprecated public static Transaction createFakeTx(NetworkParameters params)
Deprecated.Create a fake transaction, without change.
-
createFakeTxWithoutChange
public static Transaction createFakeTxWithoutChange(TransactionOutput output)
Create a fake transaction, without change.
-
createFakeCoinbaseTx
public static Transaction createFakeCoinbaseTx()
Create a fake coinbase transaction.
-
createFakeTxWithChangeAddress
public static Transaction createFakeTxWithChangeAddress(Coin value, Address to, Address changeOutput)
Create a fake TX of sufficient realism to exercise the unit tests. Two outputs, one to us, one to somewhere else to simulate change. There is one random input.
-
createFakeTxWithoutChangeAddress
public static Transaction createFakeTxWithoutChangeAddress(Coin value, Address to)
Create a fake TX for unit tests, for use with unit tests that need greater control. One outputs, 2 random inputs, split randomly to create randomness.
-
createFakeTx
public static Transaction createFakeTx(Network network, Coin value, Address to)
Create a fake TX of sufficient realism to exercise the unit tests. Two outputs, one to us, one to somewhere else to simulate change. There is one random input.
-
createFakeTx
@Deprecated public static Transaction createFakeTx(NetworkParameters params, Coin value, Address to)
Deprecated.Create a fake TX of sufficient realism to exercise the unit tests. Two outputs, one to us, one to somewhere else to simulate change. There is one random input.
-
createFakeTx
public static Transaction createFakeTx(Coin value, ECKey to)
Create a fake TX of sufficient realism to exercise the unit tests. Two outputs, one to us, one to somewhere else to simulate change. There is one random input.
-
createFakeTx
public static Transaction[] createFakeTx(Coin value, Address to, Address from)
Transaction[0] is a feeder transaction, supplying BTC to Transaction[1]
-
roundTripTransaction
public static Transaction roundTripTransaction(Transaction tx)
Roundtrip a transaction so that it appears as if it has just come from the wire
-
createFakeDoubleSpendTxns
public static FakeTxBuilder.DoubleSpends createFakeDoubleSpendTxns(Address to)
Creates two transactions that spend the same (fake) output. t1 spends to "to". t2 spends somewhere else. The fake output goes to the same address as t2.
-
createFakeBlock
public static FakeTxBuilder.BlockPair createFakeBlock(BlockStore blockStore, long version, java.time.Instant time, Transaction... transactions)
Emulates receiving a valid block that builds on top of the chain.
-
createFakeBlock
@Deprecated public static FakeTxBuilder.BlockPair createFakeBlock(BlockStore blockStore, long version, long timeSecs, Transaction... transactions)
Deprecated.
-
createFakeBlock
public static FakeTxBuilder.BlockPair createFakeBlock(BlockStore blockStore, StoredBlock previousStoredBlock, long version, java.time.Instant time, int height, Transaction... transactions)
Emulates receiving a valid block
-
createFakeBlock
@Deprecated public static FakeTxBuilder.BlockPair createFakeBlock(BlockStore blockStore, StoredBlock previousStoredBlock, long version, long timeSecs, int height, Transaction... transactions)
-
createFakeBlock
public static FakeTxBuilder.BlockPair createFakeBlock(BlockStore blockStore, StoredBlock previousStoredBlock, int height, Transaction... transactions)
-
createFakeBlock
public static FakeTxBuilder.BlockPair createFakeBlock(BlockStore blockStore, long version, java.time.Instant time, int height, Transaction... transactions)
Emulates receiving a valid block that builds on top of the chain.
-
createFakeBlock
@Deprecated public static FakeTxBuilder.BlockPair createFakeBlock(BlockStore blockStore, long version, long timeSecs, int height, Transaction... transactions)
Deprecated.
-
createFakeBlock
public static FakeTxBuilder.BlockPair createFakeBlock(BlockStore blockStore, int height, Transaction... transactions)
Emulates receiving a valid block that builds on top of the chain.
-
createFakeBlock
public static FakeTxBuilder.BlockPair createFakeBlock(BlockStore blockStore, Transaction... transactions)
Emulates receiving a valid block that builds on top of the chain.
-
makeSolvedTestBlock
public static Block makeSolvedTestBlock(BlockStore blockStore, Address coinsTo) throws BlockStoreException
- Throws:
BlockStoreException
-
makeSolvedTestBlock
public static Block makeSolvedTestBlock(Block prev, Transaction... transactions) throws BlockStoreException
- Throws:
BlockStoreException
-
makeSolvedTestBlock
public static Block makeSolvedTestBlock(Block prev, @Nullable Address to, Transaction... transactions) throws BlockStoreException
- Throws:
BlockStoreException
-
-