mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 14:16:21 +00:00
40359f9c1b
* Adding wakunode module * Adding wakuv2 fleet files * Add waku fleets to update-fleet-config script * Adding config items for waku v2 * Conditionally start waku v2 node depending on config * Adapting common code to use go-waku * Setting log level to info * update dependencies * update fleet config to use WakuNodes instead of BootNodes * send and receive messages * use hash returned when publishing a message * add waku store protocol * trigger signal after receiving store messages * exclude linting rule SA1019 to check deprecated packages
44 lines
1.3 KiB
Go
44 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"
|
|
wakuv2 "github.com/status-im/status-go/wakuv2/common"
|
|
)
|
|
|
|
// 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,
|
|
}
|
|
}
|
|
|
|
// NewWakuEnvelopeErrorWrapper returns a types.EnvelopeError object that mimics Geth's EnvelopeError
|
|
func NewWakuV2EnvelopeErrorWrapper(envelopeError *wakuv2.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 waku.EnvelopeTimeNotSynced:
|
|
return types.EnvelopeTimeNotSynced
|
|
case waku.EnvelopeOtherError:
|
|
return types.EnvelopeOtherError
|
|
}
|
|
return types.EnvelopeOtherError
|
|
}
|