mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-31 20:21:56 +00:00
draft of consensus+state code, compiles.
This commit is contained in:
@@ -119,9 +119,18 @@ func (s *State) Validators() *ValidatorSet {
|
||||
return s.validators
|
||||
}
|
||||
|
||||
func (s *State) Account(accountId uint64) *Account {
|
||||
func (s *State) Account(accountId uint64) (*Account, error) {
|
||||
s.mtx.Lock()
|
||||
defer s.mtx.Unlock()
|
||||
// XXX: figure out a way to load an Account Binary type.
|
||||
return s.accounts.Get(accountId)
|
||||
idBytes, err := BasicCodec.Write(accountId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
accountBytes := s.accounts.Get(idBytes)
|
||||
if accountBytes == nil {
|
||||
return nil, nil
|
||||
}
|
||||
n, err := int64(0), error(nil)
|
||||
account := ReadAccount(bytes.NewBuffer(accountBytes), &n, &err)
|
||||
return account, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user