Esempio n. 1
0
func (o *TxOutput) MatchesFilter(filter *FilterLoad) bool {
	// TODO Speed this up.
	s := script.ParseScriptObject(o.Script)
	for _, e := range s {
		if len(e.Data()) > 0 {
			if filter.MayContain(e.Data()) {
				return true
			}
		}
	}
	return false
}
Esempio n. 2
0
func (i *TxInput) MatchesFilter(filter *FilterLoad) bool {
	if filter.MayContain(i.PreviousOutput.Serialize()) {
		return true
	}
	s := script.ParseScriptObject(i.Signature)
	for _, e := range s {
		if len(e.Data()) > 0 {
			if filter.MayContain(e.Data()) {
				return true
			}
		}
	}
	return false
}
Esempio n. 3
0
func (i *TxInput) String() string {
	os := script.ParseScriptObject(i.Signature)
	str := fmt.Sprintf("Input: tx %s", i.PreviousOutput)
	if len(os) == 2 {
		hash := utils.RIPEMD160Hash(os[1].Data())
		addr, err := base58.BitcoinCheckEncode(
			base58.BitcoinPublicKeyHashPrefix, hash)
		if err != nil {
			str += fmt.Sprintf(" => %x", hash)
		} else {
			str += fmt.Sprintf(" => %s", addr)
		}
		str += fmt.Sprintf("\n  Signature: %x", os[0].Data())
	}
	return str
}