DarkSendEntryVin(NetworkParameters params) { isSigSet = false; vin = new TransactionInput(params, null, null); //need to set later } }
/** * Adds an input to this transaction that imports value from the given output. Note that this input is <i>not</i> * complete and after every input is added with {@link #addInput()} and every output is added with * {@link #addOutput()}, a {@link TransactionSigner} must be used to finalize the transaction and finish the inputs * off. Otherwise it won't be accepted by the network. * @return the newly created input. */ public TransactionInput addInput(TransactionOutput from) { return addInput(new TransactionInput(params, this, from)); }
public boolean has(TransactionOutPoint outpoint) { TransactionInput txin = new TransactionInput(params, null, null, outpoint); Masternode mn = find(txin); return mn != null; }
/** * Adds an input to this transaction that imports value from the given output. Note that this input is <i>not</i> * complete and after every input is added with {@link #addInput()} and every output is added with * {@link #addOutput()}, a {@link TransactionSigner} must be used to finalize the transaction and finish the inputs * off. Otherwise it won't be accepted by the network. * @return the newly created input. */ public TransactionInput addInput(TransactionOutput from) { return addInput(new TransactionInput(params, this, from)); }
/** * Adds an input to this transaction that imports value from the given output. Note that this input is <i>not</i> * complete and after every input is added with {@link #addInput(TransactionInput)} and every output is added with * {@link #addOutput(TransactionOutput)}, a {@link TransactionSigner} must be used to finalize the transaction and * finish the inputs off. Otherwise it won't be accepted by the network. * @return the newly created input. */ public TransactionInput addInput(TransactionOutput from) { return addInput(new TransactionInput(params, this, from)); }
/** Returns a copy of the input detached from its containing transaction, if need be. */ public TransactionInput duplicateDetached() { return new TransactionInput(params, null, bitcoinSerialize(), 0); }
public void askForMN(Peer pnode, TransactionOutPoint outPoint) { TransactionInput input = new TransactionInput(params, null, null, outPoint); askForMN(pnode, input); }
/** * Adds an input to this transaction that imports value from the given output. Note that this input is <i>not</i> * complete and after every input is added with {@link #addInput()} and every output is added with * {@link #addOutput()}, a {@link TransactionSigner} must be used to finalize the transaction and finish the inputs * off. Otherwise it won't be accepted by the network. * @return the newly created input. */ public TransactionInput addInput(TransactionOutput from) { return addInput(new TransactionInput(params, this, from)); }
private void addSuppliedInputs(Transaction tx, List<TransactionInput> originalInputs) { for (TransactionInput input : originalInputs) tx.addInput(new TransactionInput(params, tx, input.bitcoinSerialize())); }
private void readInputs() { long numInputs = readVarInt(); optimalEncodingMessageSize += VarInt.sizeOf(numInputs); inputs = new ArrayList<TransactionInput>((int) numInputs); for (long i = 0; i < numInputs; i++) { TransactionInput input = new TransactionInput(params, this, payload, cursor, serializer); inputs.add(input); long scriptLen = readVarInt(TransactionOutPoint.MESSAGE_LENGTH); optimalEncodingMessageSize += TransactionOutPoint.MESSAGE_LENGTH + VarInt.sizeOf(scriptLen) + scriptLen + 4; cursor += scriptLen + 4; } }
protected void readInputs() { long numInputs = readVarInt(); optimalEncodingMessageSize += VarInt.sizeOf(numInputs); inputs = new ArrayList<TransactionInput>((int) numInputs); for (long i = 0; i < numInputs; i++) { TransactionInput input = new TransactionInput(params, this, payload, cursor, serializer); inputs.add(input); long scriptLen = readVarInt(TransactionOutPoint.MESSAGE_LENGTH); optimalEncodingMessageSize += TransactionOutPoint.MESSAGE_LENGTH + VarInt.sizeOf(scriptLen) + scriptLen + 4; cursor += scriptLen + 4; } }
/** * Creates and adds an input to this transaction, with no checking that it's valid. * @return the newly created input. */ public TransactionInput addInput(Sha256Hash spendTxHash, long outputIndex, Script script) { return addInput( new TransactionInput( params, this, script.getProgram(), new TransactionOutPoint(params, outputIndex, spendTxHash))); }
/** * Creates and adds an input to this transaction, with no checking that it's valid. * @return the newly created input. */ public TransactionInput addInput(Sha256Hash spendTxHash, long outputIndex, Script script) { return addInput(new TransactionInput(params, this, script.getProgram(), new TransactionOutPoint(params, outputIndex, spendTxHash))); }
/** * Creates and adds an input to this transaction, with no checking that it's valid. * @return the newly created input. */ public TransactionInput addInput(Sha256Hash spendTxHash, long outputIndex, Script script) { return addInput(new TransactionInput(params, this, script.getProgram(), new TransactionOutPoint(params, outputIndex, spendTxHash))); }
/** * Creates and adds an input to this transaction, with no checking that it's valid. * @return the newly created input. */ public TransactionInput addInput(Sha256Hash spendTxHash, long outputIndex, Script script) { return addInput(new TransactionInput(params, this, script.getProgram(), new TransactionOutPoint(params, outputIndex, spendTxHash))); }
@Override protected void parse() throws ProtocolException { cursor = offset; denom = (int) readUint32(); vin = new TransactionInput(params, null, payload, cursor); cursor += vin.getMessageSize(); time = readInt64(); byte[] readyByte = readBytes(1); ready = readyByte[0] != 0 ? true : false; vchSig = readByteArray(); length = cursor - offset; }
@Override protected void parse() throws ProtocolException { vin = new TransactionInput(params, null, payload, cursor); cursor += vin.getMessageSize(); blockHash = readHash(); sigTime = readInt64(); vchSig = new MasternodeSignature(params, payload, cursor); cursor += vchSig.getMessageSize(); length = cursor - offset; }
@Test public void isTxConsistentReturnsFalseAsExpected() { Wallet wallet = new Wallet(PARAMS); TransactionOutput to = createMock(TransactionOutput.class); EasyMock.expect(to.isAvailableForSpending()).andReturn(true); EasyMock.expect(to.isMineOrWatched(wallet)).andReturn(true); EasyMock.expect(to.getSpentBy()).andReturn(new TransactionInput(PARAMS, null, new byte[0])); Transaction tx = FakeTxBuilder.createFakeTxWithoutChange(PARAMS, to); replay(to); boolean isConsistent = wallet.isTxConsistent(tx, false); assertFalse(isConsistent); }
@Test public void testOp0() { // Check that OP_0 doesn't NPE and pushes an empty stack frame. Transaction tx = new Transaction(PARAMS); tx.addInput(new TransactionInput(PARAMS, tx, new byte[] {})); Script script = new ScriptBuilder().smallNum(0).build(); LinkedList<byte[]> stack = new LinkedList<>(); Script.executeScript(tx, 0, script, stack, Script.ALL_VERIFY_FLAGS); assertEquals("OP_0 push length", 0, stack.get(0).length); }
/** Create a fake coinbase transaction. */ public static Transaction createFakeCoinbaseTx(final NetworkParameters params) { TransactionOutPoint outpoint = new TransactionOutPoint(params, -1, Sha256Hash.ZERO_HASH); TransactionInput input = new TransactionInput(params, null, new byte[0], outpoint); Transaction tx = new Transaction(params); tx.addInput(input); TransactionOutput outputToMe = new TransactionOutput(params, tx, Coin.FIFTY_COINS, new ECKey().toAddress(params)); tx.addOutput(outputToMe); checkState(tx.isCoinBase()); return tx; }