• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: 提交

Golang implemented sidechain for Bytom


Commit MetaInfo

修订版a8059b11358fbeeaffecb03bd49b29bd4bcef783 (tree)
时间2020-02-26 11:40:38
作者ipqhjjybj <250657661@qq.c...>
Commiteripqhjjybj

Log Message

add mov heigh

更改概述

差异

--- a/protocol/rollback_test.go
+++ b/protocol/rollback_test.go
@@ -12,14 +12,17 @@ import (
1212 )
1313
1414 type rProtocoler struct {
15+ startHeight uint64
1516 }
1617
17-func newRProtocoler() *rProtocoler {
18- return &rProtocoler{}
18+func newRProtocoler(height uint64) *rProtocoler {
19+ return &rProtocoler{
20+ startHeight: height,
21+ }
1922 }
2023
2124 func (p *rProtocoler) Name() string { return "Mock" }
22-func (p *rProtocoler) StartHeight() uint64 { return 10 }
25+func (p *rProtocoler) StartHeight() uint64 { return p.startHeight }
2326 func (p *rProtocoler) BeforeProposalBlock(txs []*types.Tx, nodeProgram []byte, blockHeight uint64, gasLeft int64, isTimeout func() bool) ([]*types.Tx, error) {
2427 return nil, nil
2528 }
@@ -37,6 +40,7 @@ func (p *rProtocoler) DetachBlock(block *types.Block) error
3740 func TestRollbackMock(t *testing.T) {
3841 cases := []struct {
3942 desc string
43+ protocolerStartHeight uint64
4044 bestBlockHeader *types.BlockHeader
4145 lastIrrBlockHeader *types.BlockHeader
4246 storedBlocks []*types.Block
@@ -48,7 +52,8 @@ func TestRollbackMock(t *testing.T) {
4852 targetHeight uint64
4953 }{
5054 {
51- desc: "first case",
55+ desc: "first case",
56+ protocolerStartHeight: 0,
5257 bestBlockHeader: &types.BlockHeader{
5358 Height: 1,
5459 PreviousBlockHash: testutil.MustDecodeHash("39dee75363127a2857f554d2ad2706eb876407a2e09fbe0338683ca4ad4c2f90"),
@@ -149,7 +154,7 @@ func TestRollbackMock(t *testing.T) {
149154
150155 for _, c := range cases {
151156 mockStore := newDummyStore()
152- mockProtocoler := newRProtocoler()
157+ mockProtocoler := newRProtocoler(c.protocolerStartHeight)
153158
154159 for _, block := range c.storedBlocks {
155160 newTrans := []*types.Tx{}
Show on old repository browser