common/src/test/java/lighthouse/protocol/WalletTestObjects.java
public void sendAmounts(Random random, long... amounts) {
        int numTxns = Math.max(1, random.nextInt(amounts.length));
        log.info("sendAmounts creating {} txns", numTxns);
        final double outputsPerTx = amounts.length / (double) numTxns;
        checkState(outputsPerTx >= 1.0);
        double cursor = 0.0;
        int numOutsSoFar = 0;
        ECKey feederKey = new ECKey();
        for (int i = 0; i < amounts.length; /* nothing */) {
            Transaction currentTx = new Transaction(params);
            cursor += outputsPerTx;
            long totalVal = 0;
            int j = 0;
            for (; j < ((int) cursor) - numOutsSoFar; j++) {
                long val = amounts[i++];
                totalVal += val;
                currentTx.addOutput(Coin.valueOf(val), wallet.freshReceiveKey().toAddress(params));
            }
            numOutsSoFar += j;
            Transaction fakeFeeder = new Transaction(params);
            TransactionOutput output = fakeFeeder.addOutput(Coin.valueOf(totalVal), feederKey);
            currentTx.addInput(output).setScriptSig(ScriptBuilder.createInputScript(TransactionSignature.dummy()));
            currentTx = FakeTxBuilder.roundTripTransaction(params, currentTx);
            // currentTx now "looks real" except for the fake input signature, but that's not checked anywhere as it
            // would not be ours anyway.
            final Transaction tx = currentTx;
            receiveViaBlock(tx);
        }
    }
/**
     * Create a set of fake transactions that send outputs in the given amounts to the wallet, distributed across
     * a random number of transactions, all in one block.
     */
Create a set of fake transactions that send outputs in the given amounts to the wallet, distributed across
a random number of transactions, all in one block.
Create a set of fake transactions that send outputs in the given amounts to the wallet distributed across a random number of transactions all in one block .
public void sendAmounts(Random random, long... amounts) {
        int numTxns = Math.max(1, random.nextInt(amounts.length));
        log.info("sendAmounts creating {} txns", numTxns);
        final double outputsPerTx = amounts.length / (double) numTxns;
        checkState(outputsPerTx >= 1.0);
        double cursor = 0.0;
        int numOutsSoFar = 0;
        ECKey feederKey = new ECKey();
        for (int i = 0; i < amounts.length; /* nothing */) {
            Transaction currentTx = new Transaction(params);
            cursor += outputsPerTx;
            long totalVal = 0;
            int j = 0;
            for (; j < ((int) cursor) - numOutsSoFar; j++) {
                long val = amounts[i++];
                totalVal += val;
                currentTx.addOutput(Coin.valueOf(val), wallet.freshReceiveKey().toAddress(params));
            }
            numOutsSoFar += j;
            Transaction fakeFeeder = new Transaction(params);
            TransactionOutput output = fakeFeeder.addOutput(Coin.valueOf(totalVal), feederKey);
            currentTx.addInput(output).setScriptSig(ScriptBuilder.createInputScript(TransactionSignature.dummy()));
            currentTx = FakeTxBuilder.roundTripTransaction(params, currentTx);
            final Transaction tx = currentTx;
            receiveViaBlock(tx);
        }
    }
public void sendAmounts ( Random random , long ... amounts ) { int numTxns = Math . max ( 1 , random . nextInt ( amounts . length ) ) ; log . info ( "sendAmounts creating {} txns" , numTxns ) ; final double outputsPerTx = amounts . length / ( double ) numTxns ; checkState ( outputsPerTx >= 1.0 ) ; double cursor = 0.0 ; int numOutsSoFar = 0 ; ECKey feederKey = new ECKey ( ) ; for ( int i = 0 ; i < amounts . length ; /* nothing */ ) { Transaction currentTx = new Transaction ( params ) ; cursor += outputsPerTx ; long totalVal = 0 ; int j = 0 ; for ( ; j < ( ( int ) cursor ) - numOutsSoFar ; j ++ ) { long val = amounts [ i ++ ] ; totalVal += val ; currentTx . addOutput ( Coin . valueOf ( val ) , wallet . freshReceiveKey ( ) . toAddress ( params ) ) ; } numOutsSoFar += j ; Transaction fakeFeeder = new Transaction ( params ) ; TransactionOutput output = fakeFeeder . addOutput ( Coin . valueOf ( totalVal ) , feederKey ) ; currentTx . addInput ( output ) . setScriptSig ( ScriptBuilder . createInputScript ( TransactionSignature . dummy ( ) ) ) ; currentTx = FakeTxBuilder . roundTripTransaction ( params , currentTx ) ; final Transaction tx = currentTx ; receiveViaBlock ( tx ) ; } }
Create a set of fake transactions that send outputs in the given amounts to the wallet, distributed across
 a random number of transactions, all in one block.
Create a set of fake transactions that send outputs in the given amounts to the wallet distributed across a random number of transactions all in one block .
// currentTx now "looks real" except for the fake input signature, but that's not checked anywhere as it // would not be ours anyway.