func (n *NetworkConnection) AddTransaction(transaction libytc.Update) { msg := new(MessageFormat) msg.Type = "Transaction" msg.Payload = n.s.EncodeUpdate(transaction) msg.Chain = transaction.Chain() n.outbound.Encode(msg) }
func (g GFCEncoder) EncodeUpdate(up libytc.Update) (out []byte) { var err error b := new(BlockMessage) b.Type = UpdateName(up) b.Message, err = json.Marshal(up) b.Chain = up.Chain() if err != nil { log.Fatal(err) } out, err = json.Marshal(b) if err != nil { log.Fatal(err) } return }
func (s *Server) EncodeUpdate(transaction libytc.Update) []byte { return s.encoder[transaction.Chain()].EncodeUpdate(transaction) }