@@ -6,9 +6,9 @@ package process
66
77import (
88 "errors"
9- cp "github.com/FactomProject/FactomCode/controlpanel "
10- "github.com/FactomProject/FactomCode/common "
11- "github.com/FactomProject/FactomCode/database"
9+ "github.com/FactomProject/FactomCode/common "
10+ cp "github.com/FactomProject/FactomCode/controlpanel "
11+ "github.com/FactomProject/FactomCode/database"
1212 "github.com/FactomProject/btcd/wire"
1313 "github.com/davecgh/go-spew/spew"
1414 "strconv"
@@ -27,12 +27,12 @@ func processDirBlock(msg *wire.MsgDirBlock) error {
2727 blk , _ := db .FetchDBlockByHeight (msg .DBlk .Header .DBHeight )
2828 if blk != nil {
2929 procLog .Info ("DBlock already exists for height:" + string (msg .DBlk .Header .DBHeight ))
30- cp .CP .AddUpdate (
31- "DBOverlap" , // tag
32- "warning" , // Category
33- "Directory Block Overlap" , // Title
34- "DBlock already exists for height:" + string (msg .DBlk .Header .DBHeight ), // Message
35- 0 ) // Expire
30+ cp .CP .AddUpdate (
31+ "DBOverlap" , // tag
32+ "warning" , // Category
33+ "Directory Block Overlap" , // Title
34+ "DBlock already exists for height:" + string (msg .DBlk .Header .DBHeight ), // Message
35+ 0 ) // Expire
3636 return nil
3737 }
3838
@@ -43,13 +43,13 @@ func processDirBlock(msg *wire.MsgDirBlock) error {
4343 fMemPool .addBlockMsg (msg , strconv .Itoa (int (msg .DBlk .Header .DBHeight ))) // store in mempool with the height as the key
4444
4545 procLog .Debug ("SyncUp: MsgDirBlock DBHeight=" , msg .DBlk .Header .DBHeight )
46- cp .CP .AddUpdate (
47- "DBSyncUp" , // tag
48- "Status" , // Category
49- "SyncUp:" , // Title
50- "MsgDirBlock DBHeigth=:" + string (msg .DBlk .Header .DBHeight ), // Message
51- 0 ) // Expire
52-
46+ cp .CP .AddUpdate (
47+ "DBSyncUp" , // tag
48+ "Status" , // Category
49+ "SyncUp:" , // Title
50+ "MsgDirBlock DBHeigth=:" + string (msg .DBlk .Header .DBHeight ), // Message
51+ 0 ) // Expire
52+
5353 return nil
5454}
5555
@@ -82,8 +82,11 @@ func processABlock(msg *wire.MsgABlock) error {
8282 }
8383
8484 //Add it to mem pool before saving it in db
85- msg .ABlk .BuildABHash ()
86- fMemPool .addBlockMsg (msg , msg .ABlk .ABHash .String ()) // store in mem pool with ABHash as key
85+ abHash , err := msg .ABlk .ABHash ()
86+ if err != nil {
87+ return err
88+ }
89+ fMemPool .addBlockMsg (msg , abHash .String ()) // store in mem pool with ABHash as key
8790
8891 procLog .Debug ("SyncUp: MsgABlock DBHeight=" , msg .ABlk .Header .DBHeight )
8992
@@ -196,7 +199,7 @@ func validateBlocksFromMemPool(b *common.DirectoryBlock, fMemPool *ftmMemPool, d
196199 if h .String () != common .GENESIS_DIR_BLOCK_HASH {
197200 // panic for milestone 1
198201 //panic("Genesis dir block is not as expected: " + h.String())
199- procLog .Errorf ("Genesis dir block is not as expected: " + h .String ())
202+ procLog .Errorf ("Genesis dir block is not as expected: " + h .String ())
200203 }
201204 }
202205
@@ -349,12 +352,12 @@ func deleteBlocksFromMemPool(b *common.DirectoryBlock, fMemPool *ftmMemPool) err
349352 default :
350353 eBlkMsg , _ := fMemPool .blockpool [dbEntry .KeyMR .String ()].(* wire.MsgEBlock )
351354 for _ , ebEntry := range eBlkMsg .EBlk .Body .EBEntries {
352- fMemPool .deleteBlockMsg (ebEntry .String ())
355+ fMemPool .deleteBlockMsg (ebEntry .String ())
353356 }
354357 fMemPool .deleteBlockMsg (dbEntry .KeyMR .String ())
355358 }
356359 }
357- fMemPool .deleteBlockMsg (strconv .Itoa (int (b .Header .DBHeight )))
360+ fMemPool .deleteBlockMsg (strconv .Itoa (int (b .Header .DBHeight )))
358361
359362 return nil
360363}
0 commit comments