This commit is contained in:
Dave Collins 2014-02-21 02:09:55 -06:00
parent 88f3c73ad1
commit 982f282e10
2 changed files with 14 additions and 14 deletions

View file

@ -1014,14 +1014,14 @@ func payToPubKeyHashScript(pubKeyHash []byte) []byte {
// script hash. It is expected that the input is a valid hash.
func payToScriptHashScript(scriptHash []byte) []byte {
return NewScriptBuilder().AddOp(OP_HASH160).AddData(scriptHash).
AddOp(OP_EQUAL).Script()
AddOp(OP_EQUAL).Script()
}
// payToPubkeyScript creates a new script to pay a transaction output to a
// public key. It is expected that the input is a valid pubkey.
func payToPubKeyScript(serializedPubKey []byte) []byte {
return NewScriptBuilder().AddData(serializedPubKey).
AddOp(OP_CHECKSIG).Script()
AddOp(OP_CHECKSIG).Script()
}
// PayToAddrScript creates a new script to pay a transaction output to a the
@ -1052,7 +1052,7 @@ func PayToAddrScript(addr btcutil.Address) ([]byte, error) {
// ErrBadNumRequired is returned from MultiSigScript when nrequired is larger
// than the number of provided public keys.
var ErrBadNumRequired = errors.New("more signatures required than keys present")
var ErrBadNumRequired = errors.New("more signatures required than keys present")
// MultiSigScript returns a valid script for a multisignature redemption where
// nrequired of the keys in pubkeys are required to have signed the transaction
@ -1064,7 +1064,7 @@ func MultiSigScript(pubkeys []*btcutil.AddressPubKey, nrequired int) ([]byte, er
}
builder := NewScriptBuilder().AddInt64(int64(nrequired))
for _, key := range pubkeys {
for _, key := range pubkeys {
builder.AddData(key.ScriptAddress())
}
builder.AddInt64(int64(len(pubkeys)))

View file

@ -2887,9 +2887,9 @@ func TestPayToAddrScript(t *testing.T) {
// mainnet p2pk 13CG6SJ3yHUXo4Cr2RY4THLLJrNFuG3gUg
p2pkCompressedMain, err := btcutil.NewAddressPubKey([]byte{
0x02, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94 , 0x34, 0x4c, 0x95,
0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d , 0x8d, 0x79, 0x03,
0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24 , 0x89, 0x5d, 0xca,
0x02, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95,
0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03,
0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca,
0x52, 0xc6, 0xb4}, btcwire.MainNet)
if err != nil {
t.Errorf("Unable to create pubkey address (compressed): %v",
@ -3020,9 +3020,9 @@ func TestPayToAddrScript(t *testing.T) {
func TestMultiSigScript(t *testing.T) {
// mainnet p2pk 13CG6SJ3yHUXo4Cr2RY4THLLJrNFuG3gUg
p2pkCompressedMain, err := btcutil.NewAddressPubKey([]byte{
0x02, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94 , 0x34, 0x4c, 0x95,
0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d , 0x8d, 0x79, 0x03,
0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24 , 0x89, 0x5d, 0xca,
0x02, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95,
0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03,
0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca,
0x52, 0xc6, 0xb4}, btcwire.MainNet)
if err != nil {
t.Errorf("Unable to create pubkey address (compressed): %v",
@ -3055,10 +3055,10 @@ func TestMultiSigScript(t *testing.T) {
}
tests := []struct {
keys []*btcutil.AddressPubKey
nrequired int
expected []byte
err error
keys []*btcutil.AddressPubKey
nrequired int
expected []byte
err error
}{
{
[]*btcutil.AddressPubKey{