Method for checking contract addresses

This commit is contained in:
obscuren 2014-06-19 13:42:47 +02:00
parent 1b431f29e5
commit 7e6684d926

@ -10,6 +10,10 @@ import (
var ContractAddr = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} var ContractAddr = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
func IsContractAddr(addr []byte) bool {
return bytes.Compare(addr, ContractAddr) == 0
}
type Transaction struct { type Transaction struct {
Nonce uint64 Nonce uint64
Recipient []byte Recipient []byte
@ -149,7 +153,7 @@ func (tx *Transaction) RlpValueDecode(decoder *ethutil.Value) {
tx.r = decoder.Get(7).Bytes() tx.r = decoder.Get(7).Bytes()
tx.s = decoder.Get(8).Bytes() tx.s = decoder.Get(8).Bytes()
if bytes.Compare(tx.Recipient, ContractAddr) == 0 { if IsContractAddr(tx.Recipient) {
tx.contractCreation = true tx.contractCreation = true
} }
} }