aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-19 19:42:47 +0800
committerobscuren <geffobscura@gmail.com>2014-06-19 19:42:47 +0800
commit7e6684d92600bc7def9469abea6d7abf33439017 (patch)
treeb8900e3ef8aaee5d4e0c64a8063fa3e5d2a5d9d1
parent1b431f29e5c2283fb3d7a0c035e7ec575a563ca7 (diff)
downloaddexon-7e6684d92600bc7def9469abea6d7abf33439017.tar.gz
dexon-7e6684d92600bc7def9469abea6d7abf33439017.tar.zst
dexon-7e6684d92600bc7def9469abea6d7abf33439017.zip
Method for checking contract addresses
-rw-r--r--ethchain/transaction.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/ethchain/transaction.go b/ethchain/transaction.go
index 9044f586e..34ab357a1 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
}
}