blockchain-poc/transaction_input.go
Brian Buller 08369bae29 Part 5
- Addresses
  - Create Wallets
  - Verify addresses
  - Require addresses for transactions
2017-09-25 15:58:17 -05:00

18 lines
375 B
Go

package main
import "bytes"
// TXInput represents a transaction input
type TXInput struct {
Txid []byte
Vout int
Signature []byte
PubKey []byte
}
// UsesKey checks whether the address initiated the transaction
func (in *TXInput) UsesKey(pubKeyHash []byte) bool {
lockingHash := HashPubKey(in.PubKey)
return bytes.Compare(lockingHash, pubKeyHash) == 0
}