Skip to content

Commit

Permalink
ensure errors are caught
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters committed Oct 25, 2023
1 parent 2add0f7 commit 2ae220a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
3 changes: 1 addition & 2 deletions app/process_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/tendermint/tendermint/types"
coretypes "github.com/tendermint/tendermint/types"
)

Expand Down Expand Up @@ -142,7 +141,7 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) (resp abci.Resp

// cache the square so we don't have to recompute it when we need to broadcast it
// out to the DA network
h, err := types.HeaderFromProto(&req.Header)
h, err := coretypes.HeaderFromProto(&req.Header)
if err != nil {
panic(fmt.Sprintf("invalid header from consensus: %v", err))
}
Expand Down
21 changes: 13 additions & 8 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package node

import (
"fmt"
"io"
"net"
"os"
"time"

"io"
"path/filepath"
"time"

"github.com/tendermint/tendermint/node"
"github.com/tendermint/tendermint/p2p"
Expand Down Expand Up @@ -49,7 +48,6 @@ type Node struct {
consensus *node.Node
app servertypes.Application
config *Filesystem
publishFn app.PublishFn
closers []Closer
logger log.Logger
}
Expand Down Expand Up @@ -80,6 +78,9 @@ func New(fs *Filesystem, publish app.PublishFn) (*Node, error) {
node.DefaultMetricsProvider(fs.Consensus.Instrumentation),
logger,
)
if err != nil {
return nil, err
}

rpcClient := local.New(tmNode)
encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...)
Expand Down Expand Up @@ -122,18 +123,21 @@ func New(fs *Filesystem, publish app.PublishFn) (*Node, error) {
}

func (n *Node) Start() error {
var err error
if err = n.consensus.Start(); err != nil {
if err := n.consensus.Start(); err != nil {
return err
}
n.addToCloser(func() error { return n.consensus.Stop() })

if n.config.App.GRPC.Enable {
n.startGRPCServer()
if err := n.startGRPCServer(); err != nil {
return err
}
}

if n.config.App.API.Enable {
n.startAPIServer()
if err := n.startAPIServer(); err != nil {
return err
}
}

// TODO: add the rosetta server
Expand Down Expand Up @@ -255,6 +259,7 @@ func NewApp(fs *Filesystem, logger log.Logger, publishFn app.PublishFn) (servert
appOpts := app.NewKVAppOptions()
appOpts.SetFromAppConfig(fs.App)
appOpts.Set(flags.FlagHome, fs.Consensus.RootDir)
appOpts.Set(app.PublishFnLabel, publishFn)

return NewAppServer(logger, db, nil, appOpts), nil
}
Expand Down

0 comments on commit 2ae220a

Please sign in to comment.