blockchain_go/transaction_input.go

19 lines
369 B
Go
Raw Normal View History

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)
2024-06-20 12:26:54 -05:00
return bytes.Equal(lockingHash, pubKeyHash)
}