mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
whisper: minor fixes
This commit is contained in:
parent
ca0eb7997e
commit
2e9d3bc0f7
4 changed files with 6 additions and 9 deletions
|
|
@ -196,13 +196,13 @@ func (api *PublicWhisperAPI) DeleteSymKey(ctx context.Context, id string) bool {
|
|||
// any incoming messages, and sends only messages originated in this node.
|
||||
func (api *PublicWhisperAPI) MakeLightClient(ctx context.Context) bool {
|
||||
api.w.SetLightClientMode(true)
|
||||
return true
|
||||
return api.w.LightClientMode()
|
||||
}
|
||||
|
||||
// CancelLightClient cancels light client mode.
|
||||
func (api *PublicWhisperAPI) CancelLightClient(ctx context.Context) bool {
|
||||
api.w.SetLightClientMode(false)
|
||||
return true
|
||||
return !api.w.LightClientMode()
|
||||
}
|
||||
|
||||
//go:generate gencodec -type NewMessage -field-override newMessageOverride -out gen_newmessage_json.go
|
||||
|
|
|
|||
|
|
@ -27,5 +27,5 @@ type Config struct {
|
|||
var DefaultConfig = Config{
|
||||
MaxMessageSize: DefaultMaxMessageSize,
|
||||
MinimumAcceptedPOW: DefaultMinimumPoW,
|
||||
RestrictConnectionBetweenLightClients: false,
|
||||
RestrictConnectionBetweenLightClients: true,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,8 +130,8 @@ func (peer *Peer) handshake() error {
|
|||
}
|
||||
}
|
||||
|
||||
b, err := s.Bool()
|
||||
if b && isLightNode && isRestrictedLightNodeConnection {
|
||||
isRemotePeerLightNode, err := s.Bool()
|
||||
if isRemotePeerLightNode && isLightNode && isRestrictedLightNodeConnection {
|
||||
return fmt.Errorf("peer [%x] is useless: two light client communication restricted", peer.ID())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -302,10 +302,7 @@ func (whisper *Whisper) LightClientModeConnectionRestricted() bool {
|
|||
return false
|
||||
}
|
||||
v, ok := val.(bool)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return v
|
||||
return v && ok
|
||||
}
|
||||
|
||||
func (whisper *Whisper) notifyPeersAboutPowRequirementChange(pow float64) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue