Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
b2e3a8ea
Unverified
Commit
b2e3a8ea
authored
Jun 21, 2021
by
Anatolie Lupacescu
Committed by
GitHub
Jun 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: main net flag (#2159)
parent
dee0655c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
3 deletions
+51
-3
cmd.go
cmd/bee/cmd/cmd.go
+3
-1
start.go
cmd/bee/cmd/start.go
+39
-2
bee.yaml
packaging/bee.yaml
+2
-0
docker-compose.yml
packaging/docker/docker-compose.yml
+1
-0
env
packaging/docker/env
+2
-0
bee.yaml
packaging/homebrew/bee.yaml
+2
-0
bee.yaml
packaging/scoop/bee.yaml
+2
-0
No files found.
cmd/bee/cmd/cmd.go
View file @
b2e3a8ea
...
...
@@ -68,6 +68,7 @@ const (
optionNamePriceOracleAddress
=
"price-oracle-address"
optionNameBlockTime
=
"block-time"
optionWarmUpTime
=
"warmup-time"
optionNameMainNet
=
"mainnet"
)
func
init
()
{
...
...
@@ -209,7 +210,7 @@ func (c *command) setAllFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
String
(
optionNameNATAddr
,
""
,
"NAT exposed address"
)
cmd
.
Flags
()
.
Bool
(
optionNameP2PWSEnable
,
false
,
"enable P2P WebSocket transport"
)
cmd
.
Flags
()
.
Bool
(
optionNameP2PQUICEnable
,
false
,
"enable P2P QUIC transport"
)
cmd
.
Flags
()
.
StringSlice
(
optionNameBootnodes
,
[]
string
{
"/dnsaddr/bootnode.ethswarm.org"
},
"initial nodes to connect to"
)
cmd
.
Flags
()
.
StringSlice
(
optionNameBootnodes
,
[]
string
{},
"initial nodes to connect to"
)
cmd
.
Flags
()
.
Bool
(
optionNameDebugAPIEnable
,
false
,
"enable debug HTTP API"
)
cmd
.
Flags
()
.
String
(
optionNameDebugAPIAddr
,
":1635"
,
"debug HTTP API listen address"
)
cmd
.
Flags
()
.
Uint64
(
optionNameNetworkID
,
10
,
"ID of the Swarm network"
)
...
...
@@ -243,6 +244,7 @@ func (c *command) setAllFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Uint64
(
optionNameBlockTime
,
15
,
"chain block time"
)
cmd
.
Flags
()
.
String
(
optionNameSwapDeploymentGasPrice
,
""
,
"gas price in wei to use for deployment and funding"
)
cmd
.
Flags
()
.
Duration
(
optionWarmUpTime
,
time
.
Minute
*
10
,
"time to warmup the node before pull/push protocols can be kicked off."
)
cmd
.
Flags
()
.
Bool
(
optionNameMainNet
,
false
,
"triggers connect to main net bootnodes."
)
}
func
newLogger
(
cmd
*
cobra
.
Command
,
verbosity
string
)
(
logging
.
Logger
,
error
)
{
...
...
cmd/bee/cmd/start.go
View file @
b2e3a8ea
...
...
@@ -127,7 +127,18 @@ inability to use, or your interaction with other nodes or the software.`)
return
errors
.
New
(
"boot node must be started as a full node"
)
}
b
,
err
:=
node
.
NewBee
(
c
.
config
.
GetString
(
optionNameP2PAddr
),
signerConfig
.
publicKey
,
signerConfig
.
signer
,
c
.
config
.
GetUint64
(
optionNameNetworkID
),
logger
,
signerConfig
.
libp2pPrivateKey
,
signerConfig
.
pssPrivateKey
,
&
node
.
Options
{
mainnet
:=
c
.
config
.
GetBool
(
optionNameMainNet
)
networkID
:=
c
.
config
.
GetUint64
(
optionNameNetworkID
)
networkID
,
err
=
parseNetworks
(
mainnet
,
networkID
)
if
err
!=
nil
{
return
err
}
bootnodes
:=
c
.
config
.
GetStringSlice
(
optionNameBootnodes
)
bootnodes
=
parseBootnodes
(
logger
,
mainnet
,
networkID
,
bootnodes
)
b
,
err
:=
node
.
NewBee
(
c
.
config
.
GetString
(
optionNameP2PAddr
),
signerConfig
.
publicKey
,
signerConfig
.
signer
,
networkID
,
logger
,
signerConfig
.
libp2pPrivateKey
,
signerConfig
.
pssPrivateKey
,
&
node
.
Options
{
DataDir
:
c
.
config
.
GetString
(
optionNameDataDir
),
CacheCapacity
:
c
.
config
.
GetUint64
(
optionNameCacheCapacity
),
DBOpenFilesLimit
:
c
.
config
.
GetUint64
(
optionNameDBOpenFilesLimit
),
...
...
@@ -141,7 +152,7 @@ inability to use, or your interaction with other nodes or the software.`)
EnableWS
:
c
.
config
.
GetBool
(
optionNameP2PWSEnable
),
EnableQUIC
:
c
.
config
.
GetBool
(
optionNameP2PQUICEnable
),
WelcomeMessage
:
c
.
config
.
GetString
(
optionWelcomeMessage
),
Bootnodes
:
c
.
config
.
GetStringSlice
(
optionNameBootnodes
)
,
Bootnodes
:
bootnodes
,
CORSAllowedOrigins
:
c
.
config
.
GetStringSlice
(
optionCORSAllowedOrigins
),
Standalone
:
c
.
config
.
GetBool
(
optionNameStandalone
),
TracingEnabled
:
c
.
config
.
GetBool
(
optionNameTracingEnabled
),
...
...
@@ -405,3 +416,29 @@ func (c *command) configureSigner(cmd *cobra.Command, logger logging.Logger) (co
pssPrivateKey
:
pssPrivateKey
,
},
nil
}
func
parseNetworks
(
main
bool
,
networkID
uint64
)
(
uint64
,
error
)
{
if
main
&&
networkID
!=
1
{
return
0
,
errors
.
New
(
"provided network ID does not match mainnet"
)
}
return
networkID
,
nil
}
func
parseBootnodes
(
log
logging
.
Logger
,
main
bool
,
networkID
uint64
,
bootnodes
[]
string
)
[]
string
{
if
len
(
bootnodes
)
>
0
{
return
bootnodes
// use provided values
}
if
main
{
return
[]
string
{
"/dnsaddr/mainnet.ethswarm.org"
}
}
if
networkID
==
10
{
return
[]
string
{
"/dnsaddr/testnet.ethswarm.org"
}
}
log
.
Warning
(
"no bootnodes defined for network ID"
,
networkID
)
return
bootnodes
}
packaging/bee.yaml
View file @
b2e3a8ea
...
...
@@ -88,3 +88,5 @@ password-file: /var/lib/bee/password
# verbosity: info
## send a welcome message string during handshakes
# welcome-message: ""
## triggers connection to main network
# bee-mainnet: false
packaging/docker/docker-compose.yml
View file @
b2e3a8ea
...
...
@@ -58,6 +58,7 @@ services:
-
BEE_TRANSACTION
-
BEE_VERBOSITY
-
BEE_WELCOME_MESSAGE
-
BEE_MAINNET
ports
:
-
"
${API_ADDR:-1633}${BEE_API_ADDR:-:1633}"
-
"
${P2P_ADDR:-1634}${BEE_P2P_ADDR:-:1634}"
...
...
packaging/docker/env
View file @
b2e3a8ea
...
...
@@ -95,3 +95,5 @@ BEE_CLEF_SIGNER_ENABLE=true
# BEE_VERBOSITY=info
## send a welcome message string during handshakes
# BEE_WELCOME_MESSAGE=
## triggers connection to main network
# BEE_MAINNET=
packaging/homebrew/bee.yaml
View file @
b2e3a8ea
...
...
@@ -88,3 +88,5 @@ password-file: /usr/local/var/lib/swarm-bee/password
# verbosity: info
## send a welcome message string during handshakes
# welcome-message: ""
## triggers connection to main network
# bee-mainnet: false
packaging/scoop/bee.yaml
View file @
b2e3a8ea
...
...
@@ -78,3 +78,5 @@ password-file: ./password
# verbosity: info
## send a welcome message string during handshakes
# welcome-message: ""
## triggers connection to main network
# bee-mainnet: false
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment