FakeTxBuilder: use throwaway key rather than address in createFakeTx()

Addresses are expensive to create, as we need to know a network they are created for.
This commit is contained in:
Andreas Schildbach 2023-04-02 17:59:27 +02:00
parent a2c242cbfe
commit d684c2cfe3

View File

@ -66,7 +66,7 @@ public class FakeTxBuilder {
/** Create a fake transaction, without change. */
public static Transaction createFakeTxWithoutChange(final NetworkParameters params, final TransactionOutput output) {
Transaction prevTx = FakeTxBuilder.createFakeTx(params, Coin.COIN, randomAddress(params));
Transaction prevTx = FakeTxBuilder.createFakeTx(params, Coin.COIN, randomKey());
Transaction tx = new Transaction(params);
tx.addOutput(output);
tx.addInput(prevTx.getOutput(0));
@ -179,7 +179,7 @@ public class FakeTxBuilder {
Transaction t = new Transaction(params);
TransactionOutput outputToMe = new TransactionOutput(t, value, to);
t.addOutput(outputToMe);
TransactionOutput change = new TransactionOutput(t, valueOf(1, 11), randomAddress(params));
TransactionOutput change = new TransactionOutput(t, valueOf(1, 11), randomKey());
t.addOutput(change);
// Make a feeder tx that sends to the from address specified. This feeder tx is not really valid but it doesn't
// matter for our purposes.