Skip to content

Commit

Permalink
chains: move "msgChan" closer to the first use (readability) (ava-lab…
Browse files Browse the repository at this point in the history
  • Loading branch information
gyuho authored May 8, 2023
1 parent 0a0e1bb commit b870515
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions chains/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,10 +629,6 @@ func (m *manager) createAvalancheChain(
return nil, err
}

// The channel through which a VM may send messages to the consensus engine
// VM uses this channel to notify engine that a block is ready to be made
msgChan := make(chan common.Message, defaultChannelSize)

// Passes messages from the avalanche engines to the network
avalancheMessageSender, err := sender.New(
ctx,
Expand Down Expand Up @@ -729,6 +725,10 @@ func (m *manager) createAvalancheChain(

ctx.Context.Metrics = avalancheRegisterer

// The channel through which a VM may send messages to the consensus engine
// VM uses this channel to notify engine that a block is ready to be made
msgChan := make(chan common.Message, defaultChannelSize)

// The only difference between using avalancheMessageSender and
// snowmanMessageSender here is where the metrics will be placed. Because we
// end up using this sender after the linearization, we pass in
Expand Down Expand Up @@ -1009,10 +1009,6 @@ func (m *manager) createSnowmanChain(
return nil, err
}

// The channel through which a VM may send messages to the consensus engine
// VM uses this channel to notify engine that a block is ready to be made
msgChan := make(chan common.Message, defaultChannelSize)

// Passes messages from the consensus engine to the network
messageSender, err := sender.New(
ctx,
Expand Down Expand Up @@ -1126,6 +1122,10 @@ func (m *manager) createSnowmanChain(
vm = tracedvm.NewBlockVM(vm, "proposervm", m.Tracer)
}

// The channel through which a VM may send messages to the consensus engine
// VM uses this channel to notify engine that a block is ready to be made
msgChan := make(chan common.Message, defaultChannelSize)

if err := vm.Initialize(
context.TODO(),
ctx.Context,
Expand Down

0 comments on commit b870515

Please sign in to comment.