Skip to content

Commit da903eb

Browse files
committed
mod init
1 parent 36e2a6b commit da903eb

File tree

5 files changed

+6
-18
lines changed

5 files changed

+6
-18
lines changed

ballot_protocol.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package scp
22

33
import (
4-
"fmt"
54
"time"
6-
7-
"github.com/sirupsen/logrus"
85
)
96

107
type SlotsLoader interface {
@@ -103,8 +100,6 @@ func (b *ballotProtocol) receive(m *Message) {
103100
b.commitVoted(m)
104101
case AcceptCommit:
105102
b.commitAccepted(m)
106-
default:
107-
logrus.Errorf("unexpected message type: %d", m.Type)
108103
}
109104
}
110105

@@ -276,7 +271,7 @@ func (b *ballotProtocol) externalize(s Slot) {
276271
}
277272

278273
b.ledger.PersistSlot(s)
279-
fmt.Println("\n", b.id, "externalized", s.Index, string(s.Value))
274+
//fmt.Println("\n", b.id, "externalized", s.Index, string(s.Value))
280275
b.reinit(s.Index + 1)
281276
}
282277

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/xdarksome/scp
2+
3+
require github.com/google/btree v1.0.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
2+
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=

main.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package scp
22

3-
import "github.com/sirupsen/logrus"
4-
53
type Value []byte
64

75
type Slot struct {
@@ -80,8 +78,6 @@ func (c *Consensus) InputMessage(m *Message) {
8078
c.nominationProtocol.inputMessages <- m
8179
case VotePrepare, AcceptPrepare, VoteCommit, AcceptCommit:
8280
c.ballotProtocol.inputMessages <- m
83-
default:
84-
logrus.Errorf("unknown message type: %d", m.Type)
8581
}
8682
}
8783

nomination_protocol.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package scp
22

3-
import (
4-
"github.com/sirupsen/logrus"
5-
)
6-
73
type Validator interface {
84
ValidateValue(Value) bool
95
}
@@ -66,8 +62,6 @@ func (n *nominationProtocol) receive(m *Message) {
6662
n.nominateVoted(m)
6763
case AcceptNominate:
6864
n.nominateAccepted(m)
69-
default:
70-
logrus.Errorf("unexpected message type: %d", m.Type)
7165
}
7266
}
7367

@@ -93,11 +87,9 @@ func (n *nominationProtocol) reinit(m protocolMessage) {
9387
}
9488

9589
func (n *nominationProtocol) nominateVoted(m *Message) {
96-
//fmt.Println(n.id, "see", m.NodeID, "has voted nominate", m.SlotIndex, string(m.Value))
9790
nominate := n.nominates.Find(m.Value)
9891
if nominate == nil {
9992
if !n.validator.ValidateValue(m.Value) {
100-
//logrus.Warnf("invalid nominate from %s", m.NodeID)
10193
return
10294
}
10395
nominate = n.nominates.Create(m.Value, n.quorumSlices)

0 commit comments

Comments
 (0)