Skip to content

Commit

Permalink
remove node.reset in gnodev
Browse files Browse the repository at this point in the history
  • Loading branch information
thehowl committed Mar 1, 2024
1 parent f967e94 commit d8c4555
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions contribs/gnodev/pkg/dev/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,55 +214,6 @@ func (d *Node) Reload(ctx context.Context) error {
return nil
}

func (d *Node) reset(ctx context.Context, genesis gnoland.GnoGenesisState) error {
var err error

// recoverError handles panics and converts them to errors.
recoverError := func() {
if r := recover(); r != nil {
panicErr, ok := r.(error)
if !ok {
panic(r) // Re-panic if not an error.
}

err = panicErr
}
}

createNode := func() {
defer recoverError()

node, nodeErr := newNode(d.logger, genesis)
if nodeErr != nil {
err = fmt.Errorf("unable to create node: %w", nodeErr)
return
}

if startErr := node.Start(); startErr != nil {
err = fmt.Errorf("unable to start the node: %w", startErr)
return
}

d.Node = node
d.client = client.NewLocal()
}

// Execute node creation and handle any errors.
createNode()
if err != nil {
return err
}

// Wait for the node to be ready
select {
case <-d.GetNodeReadiness(): // Ok
case <-ctx.Done():
return ctx.Err()
}

return err
}

// GetBlockTransactions returns the transactions contained
// within the specified block, if any
func (d *Node) GetBlockTransactions(blockNum uint64) ([]std.Tx, error) {
Expand Down

0 comments on commit d8c4555

Please sign in to comment.