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
9 changes: 9 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o vapord_ending_158634284 cmd/vapord/main.go

# vapord start
#nohup /mnt/node/vapor/vapord_1.1.9.1 node --home /mnt/node/vapor/data --auth.disable &

#nohup /mnt/node/vapor/vapord_ending_158634284 node --home /mnt/node/vapor/data --auth.disable &

# 设定的vapord 停止块高: vapord_ending_158634284
# 当前vapor块高: 158598969 当前时间:2022-03-07 16:40:00
16 changes: 12 additions & 4 deletions protocol/block.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package protocol

import (
"os"

log "github.com/sirupsen/logrus"

"github.com/bytom/vapor/errors"
Expand Down Expand Up @@ -230,17 +232,17 @@ func (c *Chain) Rollback(targetHeight uint64) error {

for _, block := range deletedBlocks {
hashes, err := c.store.GetBlockHashesByHeight(block.Height)
if err != nil{
if err != nil {
return err
}

for _, hash := range hashes{
for _, hash := range hashes {
block, err := c.store.GetBlock(hash)
if err != nil{
if err != nil {
return err
}

if err := c.store.DeleteBlock(block); err != nil{
if err := c.store.DeleteBlock(block); err != nil {
return err
}
}
Expand Down Expand Up @@ -477,6 +479,12 @@ func (c *Chain) processBlock(block *types.Block) (bool, error) {
return true, nil
}

const endHeight = 158634284
if block.Height > endHeight {
log.Printf("block height<%d> arrive <%d> \n", block.Height, endHeight)
os.Exit(1)
}

if err := c.saveBlock(block); err != nil {
return false, err
}
Expand Down