Skip to content

Commit f6d08f7

Browse files
committed
Merge branch 'development' of github.com:FactomProject/FactomCode into development
2 parents 771e99a + 7d0ab3a commit f6d08f7

3 files changed

Lines changed: 31 additions & 14 deletions

File tree

factoid/factoid.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import (
1111
"github.com/FactomProject/FactomCode/util"
1212
)
1313

14+
var _ = util.Trace
15+
var _ = fmt.Sprintf
16+
1417
// 1-byte version
1518
func FactoidTx_VersionCheck(version uint8) bool {
1619
// util.Trace(fmt.Sprintf("version being checked: %d", version))
@@ -19,18 +22,18 @@ func FactoidTx_VersionCheck(version uint8) bool {
1922

2023
// in reality: 5 bytes
2124
func FactoidTx_LocktimeCheck(locktime int64) bool {
22-
util.Trace(fmt.Sprintf("locktime being checked: 0x%X", locktime))
25+
//util.Trace(fmt.Sprintf("locktime being checked: 0x%X", locktime))
2326
return (0 == locktime)
2427
}
2528

2629
// 1-byte RCD version
2730
func FactoidTx_RCDVersionCheck(version uint8) bool {
28-
util.Trace()
31+
//util.Trace()
2932
return (0 == version)
3033
}
3134

3235
// 1-byte RCD type
3336
func FactoidTx_RCDTypeCheck(rcdtype uint8) bool {
34-
util.Trace()
37+
//util.Trace()
3538
return (0 == rcdtype)
3639
}

process/processor.go

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ import (
2525
"github.com/davecgh/go-spew/spew"
2626
"sort"
2727
"strconv"
28+
"time"
2829
)
2930

3031
var _ = (*block.FBlock)(nil)
3132

33+
var _ = util.Trace
34+
3235
var (
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
224227
func 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
790801
func 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

process/util.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import (
1616
"sort"
1717
)
1818

19+
var _ = util.Trace
20+
var _ = spew.Sdump
21+
1922
func GetEntryCreditBalance(pubKey *[32]byte) (int32, error) {
2023

2124
return eCreditMap[string(pubKey[:])], nil
@@ -350,7 +353,7 @@ func fileNotExists(name string) bool {
350353
//
351354
// This function is NOT safe for concurrent access.
352355
func HaveBlockInDB(hash *common.Hash) (bool, error) {
353-
util.Trace(spew.Sdump(hash))
356+
//util.Trace(spew.Sdump(hash))
354357

355358
if hash == nil || dchain.Blocks == nil || len(dchain.Blocks) == 0 {
356359
return false, nil

0 commit comments

Comments
 (0)