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.
|
// any incoming messages, and sends only messages originated in this node.
|
||||||
func (api *PublicWhisperAPI) MakeLightClient(ctx context.Context) bool {
|
func (api *PublicWhisperAPI) MakeLightClient(ctx context.Context) bool {
|
||||||
api.w.SetLightClientMode(true)
|
api.w.SetLightClientMode(true)
|
||||||
return true
|
return api.w.LightClientMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
// CancelLightClient cancels light client mode.
|
// CancelLightClient cancels light client mode.
|
||||||
func (api *PublicWhisperAPI) CancelLightClient(ctx context.Context) bool {
|
func (api *PublicWhisperAPI) CancelLightClient(ctx context.Context) bool {
|
||||||
api.w.SetLightClientMode(false)
|
api.w.SetLightClientMode(false)
|
||||||
return true
|
return !api.w.LightClientMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:generate gencodec -type NewMessage -field-override newMessageOverride -out gen_newmessage_json.go
|
//go:generate gencodec -type NewMessage -field-override newMessageOverride -out gen_newmessage_json.go
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,5 @@ type Config struct {
|
||||||
var DefaultConfig = Config{
|
var DefaultConfig = Config{
|
||||||
MaxMessageSize: DefaultMaxMessageSize,
|
MaxMessageSize: DefaultMaxMessageSize,
|
||||||
MinimumAcceptedPOW: DefaultMinimumPoW,
|
MinimumAcceptedPOW: DefaultMinimumPoW,
|
||||||
RestrictConnectionBetweenLightClients: false,
|
RestrictConnectionBetweenLightClients: true,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,8 @@ func (peer *Peer) handshake() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
b, err := s.Bool()
|
isRemotePeerLightNode, err := s.Bool()
|
||||||
if b && isLightNode && isRestrictedLightNodeConnection {
|
if isRemotePeerLightNode && isLightNode && isRestrictedLightNodeConnection {
|
||||||
return fmt.Errorf("peer [%x] is useless: two light client communication restricted", peer.ID())
|
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
|
return false
|
||||||
}
|
}
|
||||||
v, ok := val.(bool)
|
v, ok := val.(bool)
|
||||||
if !ok {
|
return v && ok
|
||||||
return false
|
|
||||||
}
|
|
||||||
return v
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (whisper *Whisper) notifyPeersAboutPowRequirementChange(pow float64) {
|
func (whisper *Whisper) notifyPeersAboutPowRequirementChange(pow float64) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue