func (n *NetworkConnection) AddBlock(block libytc.Block) { msg := new(MessageFormat) msg.Type = "Block" msg.Payload = n.s.EncodeBlock(block) msg.Chain = block.Chain() n.outbound.Encode(msg) }
func (g GFCEncoder) EncodeBlock(block libytc.Block) (out []byte) { b := new(EncodedGFCBlock) b.Revision = block.Revision() for _, v := range block.(*GFCBlock).updates { b.Blocks = append(b.Blocks, g.EncodeUpdate(v)) } out, err := json.Marshal(b) if err != nil { log.Fatal(err) } return }
func (s *Server) EncodeBlock(block libytc.Block) []byte { return s.encoder[block.Chain()].EncodeBlock(block) }