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
b8e478a4
Unverified
Commit
b8e478a4
authored
Apr 28, 2021
by
acud
Committed by
GitHub
Apr 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
node: fix standalone mode, fix panic (#1607)
parent
dda4d163
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
26 deletions
+39
-26
node.go
pkg/node/node.go
+39
-26
No files found.
pkg/node/node.go
View file @
b8e478a4
...
@@ -21,6 +21,7 @@ import (
...
@@ -21,6 +21,7 @@ import (
"time"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethersphere/bee/pkg/accounting"
"github.com/ethersphere/bee/pkg/accounting"
"github.com/ethersphere/bee/pkg/addressbook"
"github.com/ethersphere/bee/pkg/addressbook"
"github.com/ethersphere/bee/pkg/api"
"github.com/ethersphere/bee/pkg/api"
...
@@ -56,6 +57,7 @@ import (
...
@@ -56,6 +57,7 @@ import (
"github.com/ethersphere/bee/pkg/settlement/pseudosettle"
"github.com/ethersphere/bee/pkg/settlement/pseudosettle"
"github.com/ethersphere/bee/pkg/settlement/swap"
"github.com/ethersphere/bee/pkg/settlement/swap"
"github.com/ethersphere/bee/pkg/settlement/swap/chequebook"
"github.com/ethersphere/bee/pkg/settlement/swap/chequebook"
"github.com/ethersphere/bee/pkg/settlement/swap/transaction"
"github.com/ethersphere/bee/pkg/storage"
"github.com/ethersphere/bee/pkg/storage"
"github.com/ethersphere/bee/pkg/swarm"
"github.com/ethersphere/bee/pkg/swarm"
"github.com/ethersphere/bee/pkg/tags"
"github.com/ethersphere/bee/pkg/tags"
...
@@ -200,25 +202,32 @@ func NewBee(addr string, swarmAddress swarm.Address, publicKey ecdsa.PublicKey,
...
@@ -200,25 +202,32 @@ func NewBee(addr string, swarmAddress swarm.Address, publicKey ecdsa.PublicKey,
addressbook
:=
addressbook
.
New
(
stateStore
)
addressbook
:=
addressbook
.
New
(
stateStore
)
var
chequebookFactory
chequebook
.
Factory
var
(
var
chequebookService
chequebook
.
Service
swapBackend
*
ethclient
.
Client
var
chequeStore
chequebook
.
ChequeStore
overlayEthAddress
common
.
Address
var
cashoutService
chequebook
.
CashoutService
chainID
int64
transactionService
transaction
.
Service
swapBackend
,
overlayEthAddress
,
chainID
,
transactionMonitor
,
transactionService
,
err
:=
InitChain
(
transactionMonitor
transaction
.
Monitor
p2pCtx
,
chequebookFactory
chequebook
.
Factory
logger
,
chequebookService
chequebook
.
Service
stateStore
,
chequeStore
chequebook
.
ChequeStore
o
.
SwapEndpoint
,
cashoutService
chequebook
.
CashoutService
signer
,
)
)
if
err
!=
nil
{
if
!
o
.
Standalone
{
return
nil
,
err
swapBackend
,
overlayEthAddress
,
chainID
,
transactionMonitor
,
transactionService
,
err
=
InitChain
(
p2pCtx
,
logger
,
stateStore
,
o
.
SwapEndpoint
,
signer
,
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"init chain: %w"
,
err
)
}
b
.
ethClientCloser
=
swapBackend
.
Close
b
.
transactionMonitorCloser
=
transactionMonitor
}
}
b
.
ethClientCloser
=
swapBackend
.
Close
b
.
transactionMonitorCloser
=
transactionMonitor
if
o
.
SwapEnable
{
if
o
.
SwapEnable
{
chequebookFactory
,
err
=
InitChequebookFactory
(
chequebookFactory
,
err
=
InitChequebookFactory
(
logger
,
logger
,
...
@@ -398,17 +407,19 @@ func NewBee(addr string, swarmAddress swarm.Address, publicKey ecdsa.PublicKey,
...
@@ -398,17 +407,19 @@ func NewBee(addr string, swarmAddress swarm.Address, publicKey ecdsa.PublicKey,
hive
.
SetAddPeersHandler
(
kad
.
AddPeers
)
hive
.
SetAddPeersHandler
(
kad
.
AddPeers
)
p2ps
.
SetPickyNotifier
(
kad
)
p2ps
.
SetPickyNotifier
(
kad
)
batchStore
.
SetRadiusSetter
(
kad
)
batchStore
.
SetRadiusSetter
(
kad
)
syncedChan
:=
batchSvc
.
Start
()
// wait for the postage contract listener to sync
if
batchSvc
!=
nil
{
logger
.
Info
(
"waiting to sync postage contract data, this may take a while... more info available in Debug loglevel"
)
syncedChan
:=
batchSvc
.
Start
()
// wait for the postage contract listener to sync
logger
.
Info
(
"waiting to sync postage contract data, this may take a while... more info available in Debug loglevel"
)
// arguably this is not a very nice solution since we dont support
// arguably this is not a very nice solution since we dont support
// interrupts at this stage of the application lifecycle. some changes
// interrupts at this stage of the application lifecycle. some changes
// would be needed on the cmd level to support context cancellation at
// would be needed on the cmd level to support context cancellation at
// this stage
// this stage
<-
syncedChan
<-
syncedChan
}
paymentThreshold
,
ok
:=
new
(
big
.
Int
)
.
SetString
(
o
.
PaymentThreshold
,
10
)
paymentThreshold
,
ok
:=
new
(
big
.
Int
)
.
SetString
(
o
.
PaymentThreshold
,
10
)
if
!
ok
{
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"invalid payment threshold: %s"
,
paymentThreshold
)
return
nil
,
fmt
.
Errorf
(
"invalid payment threshold: %s"
,
paymentThreshold
)
...
@@ -683,8 +694,10 @@ func (b *Bee) Shutdown(ctx context.Context) error {
...
@@ -683,8 +694,10 @@ func (b *Bee) Shutdown(ctx context.Context) error {
errs
.
add
(
fmt
.
Errorf
(
"p2p server: %w"
,
err
))
errs
.
add
(
fmt
.
Errorf
(
"p2p server: %w"
,
err
))
}
}
if
err
:=
b
.
transactionMonitorCloser
.
Close
();
err
!=
nil
{
if
b
.
transactionMonitorCloser
!=
nil
{
errs
.
add
(
fmt
.
Errorf
(
"transaction monitor: %w"
,
err
))
if
err
:=
b
.
transactionMonitorCloser
.
Close
();
err
!=
nil
{
errs
.
add
(
fmt
.
Errorf
(
"transaction monitor: %w"
,
err
))
}
}
}
if
c
:=
b
.
ethClientCloser
;
c
!=
nil
{
if
c
:=
b
.
ethClientCloser
;
c
!=
nil
{
...
...
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