com.google.bitcoin.utils
Class TestUtils

java.lang.Object
  extended by com.google.bitcoin.utils.TestUtils

public class TestUtils
extends Object


Nested Class Summary
static class TestUtils.BlockPair
           
static class TestUtils.DoubleSpends
           
 
Constructor Summary
TestUtils()
           
 
Method Summary
static TestUtils.BlockPair createFakeBlock(BlockStore blockStore, long timeSeconds, Transaction... transactions)
           
static TestUtils.BlockPair createFakeBlock(BlockStore blockStore, Transaction... transactions)
           
static TestUtils.DoubleSpends createFakeDoubleSpendTxns(NetworkParameters params, Address to)
          Creates two transactions that spend the same (fake) output.
static Transaction createFakeTx(NetworkParameters params, BigInteger nanocoins, Address to)
           
static Transaction[] createFakeTx(NetworkParameters params, BigInteger nanocoins, Address to, Address from)
           
static Transaction createFakeTx(NetworkParameters params, BigInteger nanocoins, ECKey to)
           
static Transaction createFakeTxWithChangeAddress(NetworkParameters params, BigInteger nanocoins, Address to, Address changeOutput)
           
static Block makeSolvedTestBlock(BlockStore blockStore, Address coinsTo)
           
static Block makeSolvedTestBlock(Block prev, Transaction... transactions)
           
static Transaction roundTripTransaction(NetworkParameters params, Transaction tx)
          Roundtrip a transaction so that it appears as if it has just come from the wire
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestUtils

public TestUtils()
Method Detail

createFakeTxWithChangeAddress

public static Transaction createFakeTxWithChangeAddress(NetworkParameters params,
                                                        BigInteger nanocoins,
                                                        Address to,
                                                        Address changeOutput)
                                                 throws IOException,
                                                        ProtocolException
Throws:
IOException
ProtocolException

createFakeTx

public static Transaction createFakeTx(NetworkParameters params,
                                       BigInteger nanocoins,
                                       Address to)
                                throws IOException,
                                       ProtocolException
Throws:
IOException
ProtocolException

createFakeTx

public static Transaction createFakeTx(NetworkParameters params,
                                       BigInteger nanocoins,
                                       ECKey to)
                                throws IOException,
                                       ProtocolException
Throws:
IOException
ProtocolException

createFakeTx

public static Transaction[] createFakeTx(NetworkParameters params,
                                         BigInteger nanocoins,
                                         Address to,
                                         Address from)
                                  throws IOException,
                                         ProtocolException
Returns:
Transaction[] Transaction[0] is a feeder transaction, supplying BTC to Transaction[1]
Throws:
IOException
ProtocolException

roundTripTransaction

public static Transaction roundTripTransaction(NetworkParameters params,
                                               Transaction tx)
                                        throws IOException,
                                               ProtocolException
Roundtrip a transaction so that it appears as if it has just come from the wire

Throws:
IOException
ProtocolException

createFakeDoubleSpendTxns

public static TestUtils.DoubleSpends createFakeDoubleSpendTxns(NetworkParameters params,
                                                               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 TestUtils.BlockPair createFakeBlock(BlockStore blockStore,
                                                  long timeSeconds,
                                                  Transaction... transactions)

createFakeBlock

public static TestUtils.BlockPair createFakeBlock(BlockStore blockStore,
                                                  Transaction... transactions)

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


Copyright © 2014. All rights reserved.