From 7e6684d92600bc7def9469abea6d7abf33439017 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 19 Jun 2014 13:42:47 +0200 Subject: [PATCH] Method for checking contract addresses --- ethchain/transaction.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ethchain/transaction.go b/ethchain/transaction.go index 9044f586ed..34ab357a17 100644 --- a/ethchain/transaction.go +++ b/ethchain/transaction.go @@ -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} +func IsContractAddr(addr []byte) bool { + return bytes.Compare(addr, ContractAddr) == 0 +} + type Transaction struct { Nonce uint64 Recipient []byte @@ -149,7 +153,7 @@ func (tx *Transaction) RlpValueDecode(decoder *ethutil.Value) { tx.r = decoder.Get(7).Bytes() tx.s = decoder.Get(8).Bytes() - if bytes.Compare(tx.Recipient, ContractAddr) == 0 { + if IsContractAddr(tx.Recipient) { tx.contractCreation = true } }