mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-22 14:22:45 +01:00
HugeDeclaredSizeTransaction: in constructor send to a throwaway keys rather than addresses
Addresses are expensive to create, as we need to know a network they are created for.
This commit is contained in:
parent
cd57fea864
commit
ff6499baab
1 changed files with 2 additions and 3 deletions
|
@ -710,14 +710,13 @@ public class TransactionTest {
|
|||
public HugeDeclaredSizeTransaction(NetworkParameters params, boolean hackInputsSize, boolean hackOutputsSize, boolean hackWitnessPushCountSize) {
|
||||
super(params);
|
||||
Transaction inputTx = new Transaction(params);
|
||||
inputTx.addOutput(Coin.FIFTY_COINS, ECKey.fromPrivate(BigInteger.valueOf(123456)).toAddress(ScriptType.P2PKH, params.network()));
|
||||
inputTx.addOutput(Coin.FIFTY_COINS, new ECKey());
|
||||
this.addInput(inputTx.getOutput(0));
|
||||
this.getInput(0).disconnect();
|
||||
TransactionWitness witness = new TransactionWitness(1);
|
||||
witness.setPush(0, new byte[] {0});
|
||||
this.getInput(0).setWitness(witness);
|
||||
Address to = ECKey.fromPrivate(BigInteger.valueOf(1000)).toAddress(ScriptType.P2PKH, params.network());
|
||||
this.addOutput(Coin.COIN, to);
|
||||
this.addOutput(Coin.COIN, new ECKey());
|
||||
|
||||
this.hackInputsSize = hackInputsSize;
|
||||
this.hackOutputsSize = hackOutputsSize;
|
||||
|
|
Loading…
Add table
Reference in a new issue