mirror of
https://github.com/muun/recovery.git
synced 2025-11-11 22:40:16 -05:00
Release v0.1.0
This commit is contained in:
43
vendor/github.com/lightninglabs/neutrino/banman/reason.go
generated
vendored
Normal file
43
vendor/github.com/lightninglabs/neutrino/banman/reason.go
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
package banman
|
||||
|
||||
// Reason includes the different possible reasons which caused us to ban a peer.
|
||||
type Reason uint8
|
||||
|
||||
// We prevent using `iota` to ensure the order does not have the value since
|
||||
// these are serialized within the database.
|
||||
const (
|
||||
// ExcedeedBanThreshold signals that a peer exceeded its ban threshold.
|
||||
ExceededBanThreshold Reason = 1
|
||||
|
||||
// NoCompactFilters signals that a peer was unable to serve us compact
|
||||
// filters.
|
||||
NoCompactFilters Reason = 2
|
||||
|
||||
// InvalidFilterHeader signals that a peer served us an invalid filter
|
||||
// header.
|
||||
InvalidFilterHeader Reason = 3
|
||||
|
||||
// InvalidFilterHeaderCheckpoint signals that a peer served us an
|
||||
// invalid filter header checkpoint.
|
||||
InvalidFilterHeaderCheckpoint Reason = 4
|
||||
)
|
||||
|
||||
// String returns a human-readable description for the reason a peer was banned.
|
||||
func (r Reason) String() string {
|
||||
switch r {
|
||||
case ExceededBanThreshold:
|
||||
return "peer exceeded ban threshold"
|
||||
|
||||
case NoCompactFilters:
|
||||
return "peer was unable to serve compact filters"
|
||||
|
||||
case InvalidFilterHeader:
|
||||
return "peer served invalid filter header"
|
||||
|
||||
case InvalidFilterHeaderCheckpoint:
|
||||
return "peer served invalid filter header checkpoint"
|
||||
|
||||
default:
|
||||
return "unknown reason"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user