mirror of
https://github.com/status-im/status-go.git
synced 2025-01-24 05:31:36 +00:00
a1b3e3a772
There was a bug on status-react where it would save filters that were not listened to. This commit adds a task to clean up those filters as they might result in long syncing times. This commit also returns topics/ranges/mailserves from messenger in order to make the initialization of the app simpler and start moving logic to status-go. It also removes whisper from vendor.
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package gethbridge
|
|
|
|
import (
|
|
"github.com/status-im/status-go/eth-node/types"
|
|
waku "github.com/status-im/status-go/waku/common"
|
|
"github.com/status-im/status-go/whisper"
|
|
)
|
|
|
|
// NewWhisperEnvelopeErrorWrapper returns a types.EnvelopeError object that mimics Geth's EnvelopeError
|
|
func NewWhisperEnvelopeErrorWrapper(envelopeError *whisper.EnvelopeError) *types.EnvelopeError {
|
|
if envelopeError == nil {
|
|
panic("envelopeError should not be nil")
|
|
}
|
|
|
|
return &types.EnvelopeError{
|
|
Hash: types.Hash(envelopeError.Hash),
|
|
Code: mapGethErrorCode(envelopeError.Code),
|
|
Description: envelopeError.Description,
|
|
}
|
|
}
|
|
|
|
// NewWakuEnvelopeErrorWrapper returns a types.EnvelopeError object that mimics Geth's EnvelopeError
|
|
func NewWakuEnvelopeErrorWrapper(envelopeError *waku.EnvelopeError) *types.EnvelopeError {
|
|
if envelopeError == nil {
|
|
panic("envelopeError should not be nil")
|
|
}
|
|
|
|
return &types.EnvelopeError{
|
|
Hash: types.Hash(envelopeError.Hash),
|
|
Code: mapGethErrorCode(envelopeError.Code),
|
|
Description: envelopeError.Description,
|
|
}
|
|
}
|
|
|
|
func mapGethErrorCode(code uint) uint {
|
|
switch code {
|
|
case whisper.EnvelopeTimeNotSynced:
|
|
case waku.EnvelopeTimeNotSynced:
|
|
return types.EnvelopeTimeNotSynced
|
|
case whisper.EnvelopeOtherError:
|
|
case waku.EnvelopeOtherError:
|
|
return types.EnvelopeOtherError
|
|
}
|
|
return types.EnvelopeOtherError
|
|
}
|