diff options
author | obscuren <geffobscura@gmail.com> | 2014-03-03 18:05:12 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-03-03 18:05:12 +0800 |
commit | 9d492b0509d3614072e0f9ed9fd1dc560ba29fc9 (patch) | |
tree | baf8e50b664cc64e6e8d45a234922aacbc14c860 /ethchain/address.go | |
parent | bfed1c7cac98e135ba176c03bd7b4fe51c0dc932 (diff) | |
download | go-tangerine-9d492b0509d3614072e0f9ed9fd1dc560ba29fc9.tar go-tangerine-9d492b0509d3614072e0f9ed9fd1dc560ba29fc9.tar.gz go-tangerine-9d492b0509d3614072e0f9ed9fd1dc560ba29fc9.tar.bz2 go-tangerine-9d492b0509d3614072e0f9ed9fd1dc560ba29fc9.tar.lz go-tangerine-9d492b0509d3614072e0f9ed9fd1dc560ba29fc9.tar.xz go-tangerine-9d492b0509d3614072e0f9ed9fd1dc560ba29fc9.tar.zst go-tangerine-9d492b0509d3614072e0f9ed9fd1dc560ba29fc9.zip |
Renamed Address to Account
Diffstat (limited to 'ethchain/address.go')
-rw-r--r-- | ethchain/address.go | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/ethchain/address.go b/ethchain/address.go index a228c7566..aa1709f2c 100644 --- a/ethchain/address.go +++ b/ethchain/address.go @@ -5,31 +5,31 @@ import ( "math/big" ) -type Address struct { +type Account struct { Amount *big.Int Nonce uint64 } -func NewAddress(amount *big.Int) *Address { - return &Address{Amount: amount, Nonce: 0} +func NewAccount(amount *big.Int) *Account { + return &Account{Amount: amount, Nonce: 0} } -func NewAddressFromData(data []byte) *Address { - address := &Address{} +func NewAccountFromData(data []byte) *Account { + address := &Account{} address.RlpDecode(data) return address } -func (a *Address) AddFee(fee *big.Int) { +func (a *Account) AddFee(fee *big.Int) { a.Amount.Add(a.Amount, fee) } -func (a *Address) RlpEncode() []byte { +func (a *Account) RlpEncode() []byte { return ethutil.Encode([]interface{}{a.Amount, a.Nonce}) } -func (a *Address) RlpDecode(data []byte) { +func (a *Account) RlpDecode(data []byte) { decoder := ethutil.NewValueFromBytes(data) a.Amount = decoder.Get(0).BigInt() @@ -37,24 +37,24 @@ func (a *Address) RlpDecode(data []byte) { } type AddrStateStore struct { - states map[string]*AddressState + states map[string]*AccountState } func NewAddrStateStore() *AddrStateStore { - return &AddrStateStore{states: make(map[string]*AddressState)} + return &AddrStateStore{states: make(map[string]*AccountState)} } -func (s *AddrStateStore) Add(addr []byte, account *Address) *AddressState { - state := &AddressState{Nonce: account.Nonce, Account: account} +func (s *AddrStateStore) Add(addr []byte, account *Account) *AccountState { + state := &AccountState{Nonce: account.Nonce, Account: account} s.states[string(addr)] = state return state } -func (s *AddrStateStore) Get(addr []byte) *AddressState { +func (s *AddrStateStore) Get(addr []byte) *AccountState { return s.states[string(addr)] } -type AddressState struct { +type AccountState struct { Nonce uint64 - Account *Address + Account *Account } |