Added README docs for account/binary and renamed UInt -> Uint etc.

This commit is contained in:
Jae Kwon
2014-12-22 18:10:17 -08:00
parent 61d1635085
commit 383335d93c
21 changed files with 324 additions and 137 deletions
+2 -2
View File
@@ -55,7 +55,7 @@ func LoadState(db db_.DB) *State {
return nil
} else {
r, n, err := bytes.NewReader(buf), new(int64), new(error)
s.LastBlockHeight = ReadUVarInt(r, n, err)
s.LastBlockHeight = ReadUvarint(r, n, err)
s.LastBlockHash = ReadByteSlice(r, n, err)
s.LastBlockParts = ReadBinary(PartSetHeader{}, r, n, err).(PartSetHeader)
s.LastBlockTime = ReadTime(r, n, err)
@@ -80,7 +80,7 @@ func (s *State) Save() {
s.accounts.Save()
s.validatorInfos.Save()
buf, n, err := new(bytes.Buffer), new(int64), new(error)
WriteUVarInt(s.LastBlockHeight, buf, n, err)
WriteUvarint(s.LastBlockHeight, buf, n, err)
WriteByteSlice(s.LastBlockHash, buf, n, err)
WriteBinary(s.LastBlockParts, buf, n, err)
WriteTime(s.LastBlockTime, buf, n, err)
+3 -3
View File
@@ -25,10 +25,10 @@ func Tempfile(prefix string) (*os.File, string) {
func RandAccount(randBalance bool, minBalance uint64) (*Account, *PrivAccount) {
privAccount := GenPrivAccount()
account := NewAccount(privAccount.PubKey)
account.Sequence = RandUInt()
account.Sequence = RandUint()
account.Balance = minBalance
if randBalance {
account.Balance += uint64(RandUInt32())
account.Balance += uint64(RandUint32())
}
return account, privAccount
}
@@ -38,7 +38,7 @@ func RandValidator(randBonded bool, minBonded uint64) (*ValidatorInfo, *PrivVali
_, privVal.filename = Tempfile("priv_validator_")
bonded := minBonded
if randBonded {
bonded += uint64(RandUInt32())
bonded += uint64(RandUint32())
}
valInfo := &ValidatorInfo{
Address: privVal.Address,
+3 -3
View File
@@ -12,9 +12,9 @@ func randValidator_() *Validator {
return &Validator{
Address: RandBytes(20),
PubKey: PubKeyEd25519{RandBytes(64)},
BondHeight: uint(RandUInt32()),
VotingPower: RandUInt64(),
Accum: int64(RandUInt64()),
BondHeight: uint(RandUint32()),
VotingPower: RandUint64(),
Accum: int64(RandUint64()),
}
}