Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/kernel/kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
. "github.com/yu-org/yu/core/tripod/dev"
. "github.com/yu-org/yu/core/types"
. "github.com/yu-org/yu/utils/ip"
"go.uber.org/atomic"
"sync"
)

Expand All @@ -17,6 +18,8 @@ type Kernel struct {

RunMode RunMode

pendingBlock atomic.Pointer[Block]

stopChan chan struct{}

httpPort string
Expand Down Expand Up @@ -44,6 +47,7 @@ func NewKernel(
}

env.Execute = k.OrderedExecute
k.pendingBlock.Store(nil)

// Configure the handlers in P2P network

Expand Down
6 changes: 6 additions & 0 deletions core/kernel/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,18 @@ func (k *Kernel) Run() {

}

func (k *Kernel) GetPendingBlock() *Block {
return k.pendingBlock.Load()
}

func (k *Kernel) LocalRun() (err error) {
newBlock, err := k.makeNewBasicBlock()
if err != nil {
return err
}

k.pendingBlock.Store(newBlock)

// start a new block
err = k.land.RangeList(func(tri *Tripod) error {
tri.BlockCycle.StartBlock(newBlock)
Expand Down