Skip to content

Commit

Permalink
fixed a few issues with entry commits, chain commits, and their reveals
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSnow committed Apr 27, 2017
1 parent d2d9b4f commit c24aff5
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
1 change: 0 additions & 1 deletion common/messages/revealEntry.go
Expand Up @@ -133,7 +133,6 @@ func (m *RevealEntryMsg) ValidateRTN(state interfaces.IState) (interfaces.IMsg,
if m.Entry.KSize()+10 > ECs { // Discard commits that are not funded properly
return m.ValidateRTN(state)
}
fmt.Println("Made a chain: ", state.GetFactomNodeName(), m.Entry.GetChainID().String())
}

return commit, 1
Expand Down
1 change: 1 addition & 0 deletions engine/NetworkProcessorNet.go
Expand Up @@ -102,6 +102,7 @@ func Peers(fnode *FactomNode) {

} else {
RepeatMsgs.Inc()
//fnode.MLog.add2(fnode, false, peer.GetNameTo(), "PeerIn", false, msg)
}
}
}
Expand Down
14 changes: 0 additions & 14 deletions state/stateConsensus.go
Expand Up @@ -272,71 +272,61 @@ func (s *State) ReviewHolding() {
if ok && ff.DBHeight < saved {
delete(s.Holding, k)
}
fmt.Println("12")
continue
}

sf, ok := v.(*messages.ServerFault)
if ok && sf.DBHeight < saved {
delete(s.Holding, k)
fmt.Println("11")
continue
}

ff, ok := v.(*messages.FullServerFault)
if ok && ff.DBHeight < saved {
delete(s.Holding, k)
fmt.Println("10")
continue
}

eom, ok := v.(*messages.EOM)
if ok && ((eom.DBHeight < saved-1 && saved > 0) || (eom.DBHeight < highest-3 && highest > 2)) {
delete(s.Holding, k)
fmt.Println("9")
continue
}

dbsmsg, ok := v.(*messages.DBStateMsg)
if ok && (dbsmsg.DirectoryBlock.GetHeader().GetDBHeight() < saved-1 && saved > 0) {
delete(s.Holding, k)
fmt.Println("8")
continue
}

dbsigmsg, ok := v.(*messages.DirectoryBlockSignature)
if ok && ((dbsigmsg.DBHeight < saved-1 && saved > 0) || (dbsigmsg.DBHeight < highest-3 && highest > 2)) {
delete(s.Holding, k)
fmt.Println("7")
continue
}

_, ok = s.Replay.Valid(constants.INTERNAL_REPLAY, v.GetRepeatHash().Fixed(), v.GetTimestamp(), s.GetTimestamp())
if !ok {
delete(s.Holding, k)
fmt.Println("6")
continue
}

if v.Expire(s) {
s.ExpireCnt++
delete(s.Holding, k)
fmt.Println("5")
continue
}

if v.Resend(s) {
if v.Validate(s) == 1 {
s.ResendCnt++
v.SendOut(s, v)
fmt.Println("4")
continue
}
}

if v.Validate(s) < 0 {
delete(s.Holding, k)
fmt.Println("3")
continue
}

Expand Down Expand Up @@ -768,7 +758,6 @@ func (s *State) FollowerExecuteCommitEntry(m interfaces.IMsg) {
}

func (s *State) FollowerExecuteRevealEntry(m interfaces.IMsg) {
fmt.Println("Follower Execute")
s.Holding[m.GetMsgHash().Fixed()] = m
ack, _ := s.Acks[m.GetMsgHash().Fixed()].(*messages.Ack)

Expand Down Expand Up @@ -919,9 +908,6 @@ func (s *State) LeaderExecuteCommitEntry(m interfaces.IMsg) {
}

func (s *State) LeaderExecuteRevealEntry(m interfaces.IMsg) {

fmt.Println("Leader Execute")

re := m.(*messages.RevealEntryMsg)
eh := re.Entry.GetHash()

Expand Down

0 comments on commit c24aff5

Please sign in to comment.