Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
bysomeone committed May 10, 2024
1 parent d66f10d commit 288306c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ cli: ## Build cli binary
@go build $(BUILD_FLAGS) -v -o $(CLI) $(SRC_CLI)

build:cli ## Build the binary file
@echo $(GOARCH)
@go build $(BUILD_FLAGS) -v -o $(APP) $(SRC)
@cp cmd/chain33/chain33.toml build/
@cp cmd/chain33/bityuan.toml build/
Expand Down
8 changes: 4 additions & 4 deletions blockchain/blockfinalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ func (f *finalizer) Init(chain *BlockChain) {
chainlog.Error("newFinalizer", "decode err", err)
panic(err)
}
chainlog.Debug("newFinalizer", "height", f.choice.Height, "hash", hex.EncodeToString(f.choice.Hash))
} else {
chainlog.Info("newFinalizer", "height", f.choice.Height, "hash", hex.EncodeToString(f.choice.Hash))
} else if chain.client.GetConfig().GetModuleConfig().Consensus.Finalizer != "" {
f.choice.Height = chain.cfg.BlockFinalizeEnableHeight
chainlog.Debug("newFinalizer", "enableHeight", f.choice.Height, "gapHeight", chain.cfg.BlockFinalizeGapHeight)
chainlog.Info("newFinalizer", "enableHeight", f.choice.Height, "gapHeight", chain.cfg.BlockFinalizeGapHeight)
go f.waitFinalizeStartBlock(f.choice.Height)
}
}
Expand Down Expand Up @@ -72,7 +72,7 @@ func (f *finalizer) waitFinalizeStartBlock(beginHeight int64) {

detail, err := f.chain.GetBlock(beginHeight)
if err != nil {
chainlog.Error("setFinalizedStartHeight", "height", beginHeight, "get block err", err)
chainlog.Error("waitFinalizeStartBlock", "height", beginHeight, "waitHeight", waitHeight, "get block err", err)
panic(err)
}
_ = f.setFinalizedBlock(detail.GetBlock().Height, detail.GetBlock().Hash(f.chain.client.GetConfig()))
Expand Down
4 changes: 2 additions & 2 deletions system/consensus/snowman/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ func Test_getConnectedPeers(t *testing.T) {
require.Equal(t, utils.ErrValidatorSample, err)
_, err = v.Sample(0)
require.Equal(t, utils.ErrValidatorSample, err)
peer1 := *peer
peer1 := types.Clone(peer).(*types.Peer)
peer1.Name = "peer1"
list.Peers = []*types.Peer{peer,&peer1, self}
list.Peers = []*types.Peer{peer, peer1, self}
ids, err := v.Sample(2)
require.Nil(t, err)
require.Equal(t, 2, len(ids))
Expand Down
4 changes: 3 additions & 1 deletion system/p2p/dht/protocol/peer/peerinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
p2pty "github.com/33cn/chain33/system/p2p/dht/types"
"github.com/33cn/chain33/types"
"github.com/libp2p/go-libp2p"
dht "github.com/libp2p/go-libp2p-kad-dht"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/metrics"
"github.com/libp2p/go-libp2p/core/peer"
dht "github.com/libp2p/go-libp2p-kad-dht"
"github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -133,6 +133,8 @@ func testBlockReq(q queue.Queue) {
switch msg.Ty {
case types.EventGetLastHeader:
msg.Reply(queue.NewMessage(0, "p2p", types.EventGetLastHeader, &types.Header{}))
case types.EventSnowmanLastChoice:
msg.Reply(queue.NewMessage(0, "p2p", 0, &types.SnowChoice{}))
}
}
}()
Expand Down

0 comments on commit 288306c

Please sign in to comment.