diff options
author | obscuren <geffobscura@gmail.com> | 2014-03-21 21:47:55 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-03-21 21:47:55 +0800 |
commit | 2ea4c632d1673b762c1af11582364d9faa08c413 (patch) | |
tree | c9e87a5d79eb1bbeaee691a056a2e6974b6ba3f5 /ethchain/address.go | |
parent | fa1db8d2dcbc12fd9b343e6572c541d92fe7cb55 (diff) | |
download | dexon-2ea4c632d1673b762c1af11582364d9faa08c413.tar.gz dexon-2ea4c632d1673b762c1af11582364d9faa08c413.tar.zst dexon-2ea4c632d1673b762c1af11582364d9faa08c413.zip |
Closure return, arguments fixed. Added proper tests
Diffstat (limited to 'ethchain/address.go')
-rw-r--r-- | ethchain/address.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ethchain/address.go b/ethchain/address.go index 9c6acbe08..0b3ef7c05 100644 --- a/ethchain/address.go +++ b/ethchain/address.go @@ -6,7 +6,7 @@ import ( ) type Account struct { - Address []byte + address []byte Amount *big.Int Nonce uint64 } @@ -16,7 +16,7 @@ func NewAccount(address []byte, amount *big.Int) *Account { } func NewAccountFromData(address, data []byte) *Account { - account := &Account{Address: address} + account := &Account{address: address} account.RlpDecode(data) return account @@ -30,11 +30,15 @@ func (a *Account) AddFunds(funds *big.Int) { a.Amount.Add(a.Amount, funds) } +func (a *Account) Address() []byte { + return a.address +} + // Implements Callee func (a *Account) ReturnGas(value *big.Int, state *State) { // Return the value back to the sender a.AddFunds(value) - state.UpdateAccount(a.Address, a) + state.UpdateAccount(a.address, a) } func (a *Account) RlpEncode() []byte { |