diff --git a/blocks/adjustment.go b/blocks/adjustment.go index 0c451a4a..070cf63b 100644 --- a/blocks/adjustment.go +++ b/blocks/adjustment.go @@ -134,6 +134,7 @@ func (self *Dupeout) Type() Byte { } func (self *Dupeout) WriteTo(w io.Writer) (n int64, err error) { + n, err = WriteOnto(self.Type(), w, n, err) n, err = WriteOnto(self.VoteA, w, n, err) n, err = WriteOnto(self.VoteB, w, n, err) return diff --git a/blocks/block.go b/blocks/block.go index a2426b5a..66bee940 100644 --- a/blocks/block.go +++ b/blocks/block.go @@ -87,7 +87,7 @@ func ReadValidation(r io.Reader) Validation { sigs = append(sigs, ReadSignature(r)) } adjs := make([]Adjustment, 0, numAdjs) - for i:=0; iRead of block failed.") } } - - /* - bondTx := &BondTx{ - Signature: Signature{AccountNumber(randVar()), randBytes(32)}, - Fee: randVar(), - UnbondTo: AccountNumber(randVar()), - Amount: randVar(), - } - - unbondTx := &UnbondTx{ - Signature: Signature{AccountNumber(randVar()), randBytes(32)}, - Fee: randVar(), - Amount: randVar(), - } - */ - diff --git a/blocks/vote.go b/blocks/vote.go index 9d219d6a..92772af2 100644 --- a/blocks/vote.go +++ b/blocks/vote.go @@ -25,11 +25,8 @@ func ReadVote(r io.Reader) Vote { } func (self Vote) WriteTo(w io.Writer) (n int64, err error) { - var n_ int64 - n_, err = self.Height.WriteTo(w) - n += n_; if err != nil { return n, err } - n_, err = self.BlockHash.WriteTo(w) - n += n_; if err != nil { return n, err } - n_, err = self.Signature.WriteTo(w) - n += n_; return + n, err = WriteOnto(self.Height, w, n, err) + n, err = WriteOnto(self.BlockHash, w, n, err) + n, err = WriteOnto(self.Signature, w, n, err) + return }