patch sending message without subscription applied
This commit is contained in:
parent
aaf2b41e2e
commit
de0c03ca4e
|
@ -264,6 +264,7 @@ func (api *PublicWhisperAPI) Post(ctx context.Context, req NewMessage) (bool, er
|
||||||
WorkTime: req.PowTime,
|
WorkTime: req.PowTime,
|
||||||
PoW: req.PowTarget,
|
PoW: req.PowTarget,
|
||||||
Topic: req.Topic,
|
Topic: req.Topic,
|
||||||
|
self: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set key that is used to sign the message
|
// Set key that is used to sign the message
|
||||||
|
|
|
@ -47,6 +47,7 @@ type Envelope struct {
|
||||||
// the following variables should not be accessed directly, use the corresponding function instead: Hash(), Bloom()
|
// the following variables should not be accessed directly, use the corresponding function instead: Hash(), Bloom()
|
||||||
hash common.Hash // Cached hash of the envelope to avoid rehashing every time.
|
hash common.Hash // Cached hash of the envelope to avoid rehashing every time.
|
||||||
bloom []byte
|
bloom []byte
|
||||||
|
self bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// size returns the size of envelope as it is sent (i.e. public fields only)
|
// size returns the size of envelope as it is sent (i.e. public fields only)
|
||||||
|
|
|
@ -46,6 +46,8 @@ type MessageParams struct {
|
||||||
PoW float64
|
PoW float64
|
||||||
Payload []byte
|
Payload []byte
|
||||||
Padding []byte
|
Padding []byte
|
||||||
|
|
||||||
|
self bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// SentMessage represents an end-user data packet to transmit through the
|
// SentMessage represents an end-user data packet to transmit through the
|
||||||
|
@ -258,6 +260,7 @@ func (msg *sentMessage) Wrap(options *MessageParams) (envelope *Envelope, err er
|
||||||
if err = envelope.Seal(options); err != nil {
|
if err = envelope.Seal(options); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
envelope.self = options.self
|
||||||
return envelope, nil
|
return envelope, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -852,7 +852,7 @@ func (whisper *Whisper) add(envelope *Envelope) (bool, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !bloomFilterMatch(whisper.BloomFilter(), envelope.Bloom()) {
|
if !envelope.self && !bloomFilterMatch(whisper.BloomFilter(), envelope.Bloom()) {
|
||||||
// maybe the value was recently changed, and the peers did not adjust yet.
|
// maybe the value was recently changed, and the peers did not adjust yet.
|
||||||
// in this case the previous value is retrieved by BloomFilterTolerance()
|
// in this case the previous value is retrieved by BloomFilterTolerance()
|
||||||
// for a short period of peer synchronization.
|
// for a short period of peer synchronization.
|
||||||
|
|
Loading…
Reference in New Issue