@@ -25,10 +25,13 @@ import (
2525 "github.com/davecgh/go-spew/spew"
2626 "sort"
2727 "strconv"
28+ "time"
2829)
2930
3031var _ = (* block .FBlock )(nil )
3132
33+ var _ = util .Trace
34+
3235var (
3336 db database.Db // database
3437 dchain * common.DChain //Directory Block Chain
@@ -223,6 +226,14 @@ func serveCtlMsgRequest(msg wire.FtmInternalMsg) error {
223226// Serve incoming msg from inMsgQueue
224227func serveMsgRequest (msg wire.FtmInternalMsg ) error {
225228
229+ if msg .Command () == wire .CmdFBlock {
230+ fblock , ok := msg .(* wire.MsgFBlock )
231+ if ok {
232+ fmt .Printf ("%s : Current chain height: %v\r " , time .Now ().Format (time .RFC3339 ), fblock .SC .GetDBHeight ())
233+ }
234+
235+ }
236+
226237 switch msg .Command () {
227238 case wire .CmdCommitChain :
228239 msgCommitChain , ok := msg .(* wire.MsgCommitChain )
@@ -271,12 +282,12 @@ func serveMsgRequest(msg wire.FtmInternalMsg) error {
271282 return errors .New ("Error in build blocks:" + fmt .Sprintf ("%+v" , msg ))
272283 }
273284 procLog .Infof ("PROCESSOR: End of minute msg - wire.CmdInt_EOM:%+v\n " , msg )
274-
275- common .FactoidState .EndOfPeriod (int (msgEom .EOM_Type ))
276-
285+
286+ common .FactoidState .EndOfPeriod (int (msgEom .EOM_Type ))
287+
277288 if msgEom .EOM_Type == wire .END_MINUTE_10 {
278-
279- // Process from Orphan pool before the end of process list
289+
290+ // Process from Orphan pool before the end of process list
280291 processFromOrphanPool ()
281292
282293 // Pass the Entry Credit Exchange Rate into the Factoid component
@@ -291,7 +302,7 @@ func serveMsgRequest(msg wire.FtmInternalMsg) error {
291302 }
292303
293304 } else if msgEom .EOM_Type >= wire .END_MINUTE_1 && msgEom .EOM_Type < wire .END_MINUTE_10 {
294- ack , err := plMgr .AddMyProcessListItem (msgEom , nil , msgEom .EOM_Type )
305+ ack , err := plMgr .AddMyProcessListItem (msgEom , nil , msgEom .EOM_Type )
295306 if err != nil {
296307 return err
297308 }
@@ -762,7 +773,7 @@ func buildGenesisBlocks() error {
762773 data , _ := FBlock .MarshalBinary ()
763774 procLog .Debugf ("\n \n " , common .Sha (data ).String (), "\n \n " )
764775 dchain .AddFBlockToDBEntry (FBlock )
765- procLog .Debugf ("Factoid genesis block hash: %v\n " , FBlock .GetHash ())
776+ procLog .Debugf ("Factoid genesis block hash: %v\n " , FBlock .GetHash ())
766777 exportFctChain (fchain )
767778 // Add transactions from genesis block to factoid balances
768779 common .FactoidState .AddTransactionBlock (FBlock )
@@ -788,7 +799,7 @@ func buildGenesisBlocks() error {
788799
789800// build blocks from all process lists
790801func buildBlocks () error {
791-
802+
792803 // Allocate the first three dbentries for Admin block, ECBlock and Factoid block
793804 dchain .AddDBEntry (& common.DBEntry {}) // AdminBlock
794805 dchain .AddDBEntry (& common.DBEntry {}) // ECBlock
@@ -805,13 +816,13 @@ func buildBlocks() error {
805816
806817 // Admin chain
807818 aBlock := newAdminBlock (achain )
808-
819+
809820 dchain .AddABlockToDBEntry (aBlock )
810821 exportABlock (aBlock )
811822
812823 // Factoid chain
813824 fBlock := newFactoidBlock (fchain )
814-
825+
815826 dchain .AddFBlockToDBEntry (fBlock )
816827 exportFctBlock (fBlock )
817828
0 commit comments