Integrate go-nitro node for payments #256
@ -44,6 +44,8 @@ func addNitroFlags(command *cobra.Command) {
|
||||
command.PersistentFlags().String("nitro-naAddress", "", "nitro naAddress")
|
||||
command.PersistentFlags().String("nitro-vpaAddress", "", "nitro vpaAddress")
|
||||
command.PersistentFlags().String("nitro-caAddress", "", "nitro caAddress")
|
||||
command.PersistentFlags().Bool("nitro-useDurableStore", false, "nitro useDurableStore")
|
||||
command.PersistentFlags().String("nitro-durableStoreFolder", "", "nitro durableStoreFolder")
|
||||
|
||||
// nitro flag bindings
|
||||
viper.BindPFlag("nitro.pk", command.PersistentFlags().Lookup("nitro-pk"))
|
||||
@ -52,4 +54,6 @@ func addNitroFlags(command *cobra.Command) {
|
||||
viper.BindPFlag("nitro.naAddress", command.PersistentFlags().Lookup("nitro-naAddress"))
|
||||
viper.BindPFlag("nitro.vpaAddress", command.PersistentFlags().Lookup("nitro-vpaAddress"))
|
||||
viper.BindPFlag("nitro.caAddress", command.PersistentFlags().Lookup("nitro-caAddress"))
|
||||
viper.BindPFlag("nitro.useDurableStore", command.PersistentFlags().Lookup("nitro-useDurableStore"))
|
||||
viper.BindPFlag("nitro.durableStoreFolder", command.PersistentFlags().Lookup("nitro-durableStoreFolder"))
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ func serve() {
|
||||
|
||||
pm.Start(wg)
|
||||
|
||||
voucherValidator := paymentsmanager.InProcessValidator{PaymentsManager: pm}
|
||||
voucherValidator := paymentsmanager.InProcessVoucherValidator{PaymentsManager: pm}
|
||||
|
||||
// TODO: Configure
|
||||
queryRates := map[string]*big.Int{
|
||||
@ -389,11 +389,12 @@ func init() {
|
||||
viper.BindPFlag("validator.everyNthBlock", serveCmd.PersistentFlags().Lookup("validator-every-nth-block"))
|
||||
}
|
||||
|
||||
// https://github.com/cerc-io/go-nitro/releases/tag/github.com/cerc-io/go-nitro v0.1.1-ts-port-0.1.7
|
||||
func initializeNitroNode(nitroConfig *s.NitroConfig) (*nitroNode.Node, error) {
|
||||
// TODO: Configure
|
||||
pkString := nitroConfig.Pk
|
||||
useDurableStore := true
|
||||
durableStoreFolder := "./data/nitro-store"
|
||||
useDurableStore := nitroConfig.UseDurableStore
|
||||
durableStoreFolder := nitroConfig.DurableStoreFolder
|
||||
msgPort := 3005
|
||||
wsMsgPort := 5005
|
||||
chainUrl := nitroConfig.ChainUrl
|
||||
|
@ -33,9 +33,11 @@
|
||||
networkID = "1" # $ETH_NETWORK_ID
|
||||
|
||||
[nitro]
|
||||
pk = ""
|
||||
chainPk = ""
|
||||
chainUrl = ""
|
||||
naAddress = ""
|
||||
vpaAddress = ""
|
||||
caAddress = ""
|
||||
pk = "" # NITRO_PK
|
||||
chainPk = "" # NITRO_CHAIN_PK
|
||||
chainUrl = "" # NITRO_CHAIN_URL
|
||||
naAddress = "" # NITRO_NA_ADDRESS
|
||||
vpaAddress = "" # NITRO_VPA_ADDRESS
|
||||
caAddress = "" # NITRO_CA_ADDRESS
|
||||
useDurableStore = false # NITRO_USE_DURABLE_STORE
|
||||
durableStoreFolder = "" # NITRO_DURABLE_STORE_FOLDER
|
||||
|
@ -80,21 +80,25 @@ const (
|
||||
DATABASE_MAX_OPEN_CONNECTIONS = "DATABASE_MAX_OPEN_CONNECTIONS"
|
||||
DATABASE_MAX_CONN_LIFETIME = "DATABASE_MAX_CONN_LIFETIME"
|
||||
|
||||
NITRO_PK = "NITRO_PK"
|
||||
NITRO_CHAIN_PK = "NITRO_CHAIN_PK"
|
||||
NITRO_CHAIN_URL = "NITRO_CHAIN_URL"
|
||||
NITRO_NA_ADDRESS = "NITRO_NA_ADDRESS"
|
||||
NITRO_VPA_ADDRESS = "NITRO_VPA_ADDRESS"
|
||||
NITRO_CA_ADDRESS = "NITRO_CA_ADDRESS"
|
||||
NITRO_PK = "NITRO_PK"
|
||||
NITRO_CHAIN_PK = "NITRO_CHAIN_PK"
|
||||
NITRO_CHAIN_URL = "NITRO_CHAIN_URL"
|
||||
NITRO_NA_ADDRESS = "NITRO_NA_ADDRESS"
|
||||
NITRO_VPA_ADDRESS = "NITRO_VPA_ADDRESS"
|
||||
NITRO_CA_ADDRESS = "NITRO_CA_ADDRESS"
|
||||
NITRO_USE_DURABLE_STORE = "NITRO_USE_DURABLE_STORE"
|
||||
NITRO_DURABLE_STORE_FOLDER = "NITRO_DURABLE_STORE_FOLDER"
|
||||
)
|
||||
|
||||
type NitroConfig struct {
|
||||
Pk string
|
||||
ChainPk string
|
||||
ChainUrl string
|
||||
NaAddress string
|
||||
VpaAddress string
|
||||
CaAddress string
|
||||
Pk string
|
||||
ChainPk string
|
||||
ChainUrl string
|
||||
NaAddress string
|
||||
VpaAddress string
|
||||
CaAddress string
|
||||
UseDurableStore bool
|
||||
DurableStoreFolder string
|
||||
}
|
||||
|
||||
// Config struct
|
||||
@ -309,6 +313,8 @@ func (c *Config) loadNitroConfig() {
|
||||
viper.BindEnv("nitro.naAddress", NITRO_NA_ADDRESS)
|
||||
viper.BindEnv("nitro.vpaAddress", NITRO_VPA_ADDRESS)
|
||||
viper.BindEnv("nitro.caAddress", NITRO_CA_ADDRESS)
|
||||
viper.BindEnv("nitro.useDurableStore", NITRO_USE_DURABLE_STORE)
|
||||
viper.BindEnv("nitro.durableStoreFolder", NITRO_DURABLE_STORE_FOLDER)
|
||||
|
||||
c.Nitro.Pk = viper.GetString("nitro.pk")
|
||||
c.Nitro.ChainPk = viper.GetString("nitro.chainPk")
|
||||
@ -316,6 +322,8 @@ func (c *Config) loadNitroConfig() {
|
||||
c.Nitro.NaAddress = viper.GetString("nitro.naAddress")
|
||||
c.Nitro.VpaAddress = viper.GetString("nitro.vpaAddress")
|
||||
c.Nitro.CaAddress = viper.GetString("nitro.caAddress")
|
||||
c.Nitro.UseDurableStore = viper.GetBool("nitro.useDurableStore")
|
||||
c.Nitro.DurableStoreFolder = viper.GetString("nitro.durableStoreFolder")
|
||||
}
|
||||
|
||||
func (c *Config) loadGroupCacheConfig() {
|
||||
|
Loading…
Reference in New Issue
Block a user