From 0f84b9c30d06a59f20a2d33ffd1281d5e6e2681a Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 4 Aug 2014 16:34:55 +0200 Subject: Added exist method --- ethpipe/pipe.go | 4 ++++ ethpipe/pipe_test.go | 1 + 2 files changed, 5 insertions(+) (limited to 'ethpipe') diff --git a/ethpipe/pipe.go b/ethpipe/pipe.go index 710fc4e7c..ca0a3416c 100644 --- a/ethpipe/pipe.go +++ b/ethpipe/pipe.go @@ -75,6 +75,10 @@ func (self *Pipe) ToAddress(priv []byte) []byte { return pair.Address() } +func (self *Pipe) Exists(addr []byte) bool { + return self.World().Get(addr) != nil +} + func (self *Pipe) TransactString(key *ethcrypto.KeyPair, rec string, value, gas, price *ethutil.Value, data []byte) error { // Check if an address is stored by this address var hash []byte diff --git a/ethpipe/pipe_test.go b/ethpipe/pipe_test.go index d0b8ef948..071213050 100644 --- a/ethpipe/pipe_test.go +++ b/ethpipe/pipe_test.go @@ -34,6 +34,7 @@ func TestNew(t *testing.T) { pipe.Block(addr) pipe.Storage(addr, addr) pipe.ToAddress(privy) + pipe.Exists(addr) // Doesn't change state pipe.Execute(addr, nil, Val(0), Val(1000000), Val(10)) // Doesn't change state -- cgit