remove TimeoutTx

This commit is contained in:
Jae Kwon
2014-10-12 17:57:23 -07:00
parent 7652c5d0de
commit f4b42cdfab
5 changed files with 85 additions and 71 deletions

View File

@ -11,28 +11,34 @@ import (
// TODO consider moving this to another common types package.
type Validator struct {
Account
BondHeight uint32 // TODO: is this needed?
VotingPower uint64
Accum int64
BondHeight uint32
UnbondHeight uint32
LastCommitHeight uint32
VotingPower uint64
Accum int64
}
// Used to persist the state of ConsensusStateControl.
func ReadValidator(r io.Reader, n *int64, err *error) *Validator {
return &Validator{
Account: ReadAccount(r, n, err),
BondHeight: ReadUInt32(r, n, err),
VotingPower: ReadUInt64(r, n, err),
Accum: ReadInt64(r, n, err),
Account: ReadAccount(r, n, err),
BondHeight: ReadUInt32(r, n, err),
UnbondHeight: ReadUInt32(r, n, err),
LastCommitHeight: ReadUInt32(r, n, err),
VotingPower: ReadUInt64(r, n, err),
Accum: ReadInt64(r, n, err),
}
}
// Creates a new copy of the validator so we can mutate accum.
func (v *Validator) Copy() *Validator {
return &Validator{
Account: v.Account,
BondHeight: v.BondHeight,
VotingPower: v.VotingPower,
Accum: v.Accum,
Account: v.Account,
BondHeight: v.BondHeight,
UnbondHeight: v.UnbondHeight,
LastCommitHeight: v.LastCommitHeight,
VotingPower: v.VotingPower,
Accum: v.Accum,
}
}
@ -40,6 +46,8 @@ func (v *Validator) Copy() *Validator {
func (v *Validator) WriteTo(w io.Writer) (n int64, err error) {
WriteBinary(w, v.Account, &n, &err)
WriteUInt32(w, v.BondHeight, &n, &err)
WriteUInt32(w, v.UnbondHeight, &n, &err)
WriteUInt32(w, v.LastCommitHeight, &n, &err)
WriteUInt64(w, v.VotingPower, &n, &err)
WriteInt64(w, v.Accum, &n, &err)
return