Skip to content

Commit

Permalink
Merge pull request #613 from MinterTeam/dev
Browse files Browse the repository at this point in the history
v2.0.2
  • Loading branch information
danil-lashin authored Apr 14, 2021
2 parents 35d488a + c96b8f5 commit f928419
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 28 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [v2.0.2](https://github.com/MinterTeam/minter-go-node/tree/v2.0.2)

[Full Changelog](https://github.com/MinterTeam/minter-go-node/compare/v2.0.1...v2.0.2)

### Fixed

- Fix restart bug

## [v2.0.1](https://github.com/MinterTeam/minter-go-node/tree/v2.0.1)

Expand All @@ -11,6 +18,7 @@
- Connecting to peers with cli

### Added

- Default link to current genesis

## [v2.0.0](https://github.com/MinterTeam/minter-go-node/tree/v2.0)
Expand Down
25 changes: 14 additions & 11 deletions coreV2/state/commission/commission.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,23 +350,21 @@ func (c *Commission) SetNewCommissions(prices []byte) {
func (c *Commission) getOrNew(height uint64, encode string) *Model {
prices := c.get(height)

if len(prices) == 0 {
price := &Model{
height: height,
Price: encode,
markDirty: c.markDirty(height),
}
c.setToMap(height, []*Model{price})
return price
}

for _, model := range prices {
if encode == model.Price {
return model
}
}

return nil
price := &Model{
Votes: []types.Pubkey{},
Price: encode,
height: height,
markDirty: c.markDirty(height),
}
c.setToMap(height, append(prices, price))

return price
}

func (c *Commission) get(height uint64) []*Model {
Expand All @@ -384,6 +382,11 @@ func (c *Commission) get(height uint64) []*Model {
panic(fmt.Sprintf("failed to decode halt blocks at height %d: %s", height, err))
}

for _, vote := range voteBlock {
vote.markDirty = c.markDirty(height)
vote.height = height
}

c.setToMap(height, voteBlock)

return voteBlock
Expand Down
33 changes: 17 additions & 16 deletions coreV2/state/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (c *Update) Export(state *types.AppState) {
for _, u := range updates {
state.UpdateVotes = append(state.UpdateVotes, types.UpdateVote{
Height: height,
Votes: nil,
Votes: u.Votes,
Version: u.Version,
})
}
Expand Down Expand Up @@ -123,30 +123,26 @@ func (c *Update) GetVotes(height uint64) []*Model {
}

func (c *Update) getOrNew(height uint64, version string) *Model {
prices := c.get(height)

if len(prices) == 0 {
price := &Model{
height: height,
Version: version,
markDirty: c.markDirty(height),
}
c.setToMap(height, []*Model{price})
return price
}
models := c.get(height)

for _, model := range prices {
for _, model := range models {
if version == model.Version {
return model
}
}

return nil
price := &Model{
height: height,
Version: version,
markDirty: c.markDirty(height),
}
c.setToMap(height, append(models, price))
return price
}

func (c *Update) get(height uint64) []*Model {
if haltBlock := c.getFromMap(height); haltBlock != nil {
return haltBlock
if models := c.getFromMap(height); models != nil {
return models
}

_, enc := c.immutableTree().Get(getPath(height))
Expand All @@ -159,6 +155,11 @@ func (c *Update) get(height uint64) []*Model {
panic(fmt.Sprintf("failed to decode halt blocks at height %d: %s", height, err))
}

for _, vote := range voteBlock {
vote.markDirty = c.markDirty(height)
vote.height = height
}

c.setToMap(height, voteBlock)

return voteBlock
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const (

var (
// Version must be a string because scripts like dist.sh read this file.
Version = "2.0.1"
Version = "2.0.2"

// GitCommit is the current HEAD set using ldflags.
GitCommit string
Expand Down

0 comments on commit f928419

Please sign in to comment.