fix: return value check, support numShardsInNetwork

This commit is contained in:
Gabriel mermelstein 2025-07-14 12:25:18 +02:00
parent aba84ffc7b
commit d750a706a1
No known key found for this signature in database
GPG Key ID: 82B8134785FEAE0D
2 changed files with 5 additions and 4 deletions

View File

@ -36,4 +36,5 @@ type WakuConfig struct {
DnsAddrsNameServers []string `json:"dnsAddrsNameServers,omitempty"`
Discv5EnrAutoUpdate bool `json:"discv5EnrAutoUpdate,omitempty"`
MaxConnections int `json:"maxConnections,omitempty"`
NumShardsInNetwork uint16 `json:"numShardsInNetwork"`
}

View File

@ -398,16 +398,16 @@ func NewWakuNode(config *common.WakuConfig, nodeName string) (*WakuNode, error)
defer C.free(unsafe.Pointer(cJsonConfig))
defer C.freeResp(resp)
wg.Add(1)
n.wakuCtx = C.cGoWakuNew(cJsonConfig, resp)
wg.Wait()
if C.getRet(resp) != C.RET_OK {
errMsg := C.GoStringN(C.getMyCharPtr(resp), C.int(C.getMyCharLen(resp)))
Error("error wakuNew for %s: %v", nodeName, errMsg)
return nil, errors.New(errMsg)
}
wg.Add(1)
n.wakuCtx = C.cGoWakuNew(cJsonConfig, resp)
wg.Wait()
n.MsgChan = make(chan common.Envelope, MsgChanBufferSize)
n.TopicHealthChan = make(chan topicHealth, TopicHealthChanBufferSize)
n.ConnectionChangeChan = make(chan connectionChange, ConnectionChangeChanBufferSize)