Rename signTxOutput to RawTxInSignature

This commit is contained in:
Guilherme Salgado 2014-10-31 10:14:41 -02:00 committed by Dave Collins
parent 45e7fe103f
commit 2f902a5880

View file

@ -1098,7 +1098,7 @@ func MultiSigScript(pubkeys []*btcutil.AddressPubKey, nrequired int) ([]byte, er
// compress. This format must match the same format used to generate // compress. This format must match the same format used to generate
// the payment address, or the script validation will fail. // the payment address, or the script validation will fail.
func SignatureScript(tx *btcwire.MsgTx, idx int, subscript []byte, hashType SigHashType, privKey *btcec.PrivateKey, compress bool) ([]byte, error) { func SignatureScript(tx *btcwire.MsgTx, idx int, subscript []byte, hashType SigHashType, privKey *btcec.PrivateKey, compress bool) ([]byte, error) {
sig, err := signTxOutput(tx, idx, subscript, hashType, privKey) sig, err := RawTxInSignature(tx, idx, subscript, hashType, privKey)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1114,7 +1114,9 @@ func SignatureScript(tx *btcwire.MsgTx, idx int, subscript []byte, hashType SigH
return NewScriptBuilder().AddData(sig).AddData(pkData).Script(), nil return NewScriptBuilder().AddData(sig).AddData(pkData).Script(), nil
} }
func signTxOutput(tx *btcwire.MsgTx, idx int, subScript []byte, // RawTxInSignature returns the serialized ECDSA signature for the input
// idx of the given transaction, with hashType appended to it.
func RawTxInSignature(tx *btcwire.MsgTx, idx int, subScript []byte,
hashType SigHashType, key *btcec.PrivateKey) ([]byte, error) { hashType SigHashType, key *btcec.PrivateKey) ([]byte, error) {
parsedScript, err := parseScript(subScript) parsedScript, err := parseScript(subScript)
if err != nil { if err != nil {
@ -1130,7 +1132,7 @@ func signTxOutput(tx *btcwire.MsgTx, idx int, subScript []byte,
} }
func p2pkSignatureScript(tx *btcwire.MsgTx, idx int, subScript []byte, hashType SigHashType, privKey *btcec.PrivateKey) ([]byte, error) { func p2pkSignatureScript(tx *btcwire.MsgTx, idx int, subScript []byte, hashType SigHashType, privKey *btcec.PrivateKey) ([]byte, error) {
sig, err := signTxOutput(tx, idx, subScript, hashType, privKey) sig, err := RawTxInSignature(tx, idx, subScript, hashType, privKey)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1154,7 +1156,7 @@ func signMultiSig(tx *btcwire.MsgTx, idx int, subScript []byte, hashType SigHash
if err != nil { if err != nil {
continue continue
} }
sig, err := signTxOutput(tx, idx, subScript, hashType, key) sig, err := RawTxInSignature(tx, idx, subScript, hashType, key)
if err != nil { if err != nil {
continue continue
} }