Package org.bitcoinj.testing
Class FakeTxBuilder
java.lang.Object
org.bitcoinj.testing.FakeTxBuilder
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
Modifier and TypeClassDescriptionstatic class
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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, 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, 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, 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
Create a fake coinbase transaction.static FakeTxBuilder.DoubleSpends
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
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
Roundtrip a transaction so that it appears as if it has just come from the wire
-
Constructor Details
-
FakeTxBuilder
public FakeTxBuilder()
-
-
Method Details
-
createFakeTx
Create a fake transaction, without change. -
createFakeTx
Deprecated.Create a fake transaction, without change. -
createFakeTxWithoutChange
Create a fake transaction, without change. -
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
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
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
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
Transaction[0] is a feeder transaction, supplying BTC to Transaction[1] -
roundTripTransaction
Roundtrip a transaction so that it appears as if it has just come from the wire -
createFakeDoubleSpendTxns
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, 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, 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, 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
-
createFakeBlock(BlockStore, long, Instant, int, Transaction...)