// Process block takes care of sorting out transactions with exodus output. // At this point it doesn't matter whether the Txs are valid or not. Validation // is done at the proper handlers. func (s *MastercoinServer) ProcessBlock(block *btcutil.Block) error { // Gather transactions from this block which had an exodus output txPack := &mscutil.TxPack{ Txs: mscutil.GetExodusTransactions(block), Time: block.MsgBlock().Header.Timestamp.Unix(), Height: block.Height(), } // Update Exodus Vesting // // balance = ((1-(0.5 ** time_difference)) * 5631623576222 .round(8) if len(txPack.Txs) > 0 { serializedData, err := txPack.Serialize() if err != nil { return err } s.db.CreateTxPack(txPack.Height, serializedData) mscutil.Logger.Println("Mastercoin data found at block with height:", txPack.Height) // Queue the slice of transactions for further processing by the // message parser. _ = s.msgParser.ProcessTransactions(txPack) } return nil }
// Process block takes care of sorting out transactions with exodus output. // At this point it doesn't matter whether the Txs are valid or not. Validation // is done at the proper handlers. func (s *MastercoinServer) ProcessBlock(block *btcutil.Block) error { // Gather transactions from this block which had an exodus output txPack := &TxPack{ txs: mscutil.GetExodusTransactions(block), time: block.MsgBlock().Header.Timestamp.Unix(), height: block.Height(), } if len(txPack.txs) > 0 { /* TODO: We want to start persisting raw data here var buffer bytes.Buffer enc := gob.NewEncoder(&buffer) err := enc.Encode(txPack) if err != nil { mscutil.Logger.Fatal(err) } dec := gob.NewDecoder(&buffer) var pack TxPack err = dec.Decode(&pack) if err != nil { mscutil.Logger.Fatal(err) } */ // Queue the slice of transactions for further processing by the // message parser. _ = s.msgParser.ProcessTransactions(txPack) // mscutil.Logger.Println(messages) } return nil }