add more logging to consensus code
This commit is contained in:
parent
093890b5ff
commit
4c66a72410
@ -81,9 +81,11 @@ type Consensus struct {
|
|||||||
// the weight has to be of a value of 1 or above.
|
// the weight has to be of a value of 1 or above.
|
||||||
func (c *Consensus) AddVoter(source Source, weight uint) error {
|
func (c *Consensus) AddVoter(source Source, weight uint) error {
|
||||||
if source == nil {
|
if source == nil {
|
||||||
|
c.logger.Println("[ERROR] could not add voter: no source given")
|
||||||
return ErrNoSource
|
return ErrNoSource
|
||||||
}
|
}
|
||||||
if weight == 0 {
|
if weight == 0 {
|
||||||
|
c.logger.Println("[ERROR] could not add voter: weight cannot be 0")
|
||||||
return ErrInsufficientWeight
|
return ErrInsufficientWeight
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,6 +127,7 @@ func (c *Consensus) ExternalIP() (net.IP, error) {
|
|||||||
// if no votes were casted succesfully,
|
// if no votes were casted succesfully,
|
||||||
// return early with an error
|
// return early with an error
|
||||||
if len(voteCollection) == 0 {
|
if len(voteCollection) == 0 {
|
||||||
|
c.logger.Println("[ERROR] no votes were casted succesfully")
|
||||||
return nil, ErrNoIP
|
return nil, ErrNoIP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user