2023-09-12 19:14:08 +00:00
|
|
|
//go:build !gowaku_no_rln
|
|
|
|
// +build !gowaku_no_rln
|
2022-08-12 12:44:13 +00:00
|
|
|
|
|
|
|
package node
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
2022-11-09 19:53:01 +00:00
|
|
|
"github.com/waku-org/go-waku/waku/v2/protocol/rln"
|
2022-10-27 15:23:20 +00:00
|
|
|
r "github.com/waku-org/go-zerokit-rln/rln"
|
2022-08-12 12:44:13 +00:00
|
|
|
)
|
|
|
|
|
2022-08-18 14:42:18 +00:00
|
|
|
// WithStaticRLNRelay enables the Waku V2 RLN protocol in offchain mode
|
2023-09-04 21:44:41 +00:00
|
|
|
func WithStaticRLNRelay(memberIndex *r.MembershipIndex, spamHandler rln.SpamHandler) WakuNodeOption {
|
2022-08-12 12:44:13 +00:00
|
|
|
return func(params *WakuNodeParameters) error {
|
|
|
|
params.enableRLN = true
|
|
|
|
params.rlnRelayDynamic = false
|
|
|
|
params.rlnRelayMemIndex = memberIndex
|
|
|
|
params.rlnSpamHandler = spamHandler
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-05 19:44:46 +00:00
|
|
|
// WithDynamicRLNRelay enables the Waku V2 RLN protocol in onchain mode.
|
2023-09-04 21:44:41 +00:00
|
|
|
func WithDynamicRLNRelay(keystorePath string, keystorePassword string, treePath string, membershipContract common.Address, membershipIndex *uint, spamHandler rln.SpamHandler, ethClientAddress string) WakuNodeOption {
|
2022-08-12 12:44:13 +00:00
|
|
|
return func(params *WakuNodeParameters) error {
|
|
|
|
params.enableRLN = true
|
|
|
|
params.rlnRelayDynamic = true
|
2023-04-05 19:44:46 +00:00
|
|
|
params.keystorePassword = keystorePassword
|
|
|
|
params.keystorePath = keystorePath
|
2022-08-12 12:44:13 +00:00
|
|
|
params.rlnSpamHandler = spamHandler
|
|
|
|
params.rlnETHClientAddress = ethClientAddress
|
2023-04-05 19:44:46 +00:00
|
|
|
params.rlnMembershipContractAddress = membershipContract
|
2023-08-24 18:42:50 +00:00
|
|
|
params.rlnRelayMemIndex = membershipIndex
|
2023-08-18 13:59:37 +00:00
|
|
|
params.rlnTreePath = treePath
|
2022-08-12 12:44:13 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|