mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 05:27:17 +00:00
Transaction.addSignedInput: catch API usage error.
This commit is contained in:
@@ -36,6 +36,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.google.bitcoin.core.Utils.*;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
/**
|
||||
* <p>A transaction represents the movement of coins from some addresses to some other addresses. It can also represent
|
||||
@@ -744,6 +745,8 @@ public class Transaction extends ChildMessage implements Serializable {
|
||||
*/
|
||||
public TransactionInput addSignedInput(TransactionOutPoint prevOut, Script scriptPubKey, ECKey sigKey,
|
||||
SigHash sigHash, boolean anyoneCanPay) throws ScriptException {
|
||||
// Verify the API user didn't try to do operations out of order.
|
||||
checkState(!outputs.isEmpty(), "Attempting to sign tx without outputs.");
|
||||
TransactionInput input = new TransactionInput(params, this, new byte[]{}, prevOut);
|
||||
addInput(input);
|
||||
Sha256Hash hash = hashForSignature(inputs.size() - 1, scriptPubKey, sigHash, anyoneCanPay);
|
||||
|
||||
Reference in New Issue
Block a user