2017-09-09 22:54:58 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "bytes"
|
|
|
|
|
|
|
|
// TXInput represents a transaction input
|
|
|
|
type TXInput struct {
|
|
|
|
Txid []byte
|
|
|
|
Vout int
|
2017-09-10 02:05:23 -05:00
|
|
|
Signature []byte
|
|
|
|
PubKey []byte
|
2017-09-09 22:54:58 -05:00
|
|
|
}
|
|
|
|
|
2017-09-10 00:45:15 -05:00
|
|
|
// UsesKey checks whether the address initiated the transaction
|
|
|
|
func (in *TXInput) UsesKey(pubKeyHash []byte) bool {
|
2017-09-10 02:05:23 -05:00
|
|
|
lockingHash := HashPubKey(in.PubKey)
|
2017-09-09 22:54:58 -05:00
|
|
|
|
|
|
|
return bytes.Compare(lockingHash, pubKeyHash) == 0
|
|
|
|
}
|