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,
|
||||
PoW: req.PowTarget,
|
||||
Topic: req.Topic,
|
||||
self: true,
|
||||
}
|
||||
|
||||
// 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()
|
||||
hash common.Hash // Cached hash of the envelope to avoid rehashing every time.
|
||||
bloom []byte
|
||||
self bool
|
||||
}
|
||||
|
||||
// size returns the size of envelope as it is sent (i.e. public fields only)
|
||||
|
|
|
@ -46,6 +46,8 @@ type MessageParams struct {
|
|||
PoW float64
|
||||
Payload []byte
|
||||
Padding []byte
|
||||
|
||||
self bool
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return nil, err
|
||||
}
|
||||
envelope.self = options.self
|
||||
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.
|
||||
// in this case the previous value is retrieved by BloomFilterTolerance()
|
||||
// for a short period of peer synchronization.
|
||||
|
|
Loading…
Reference in New Issue