Skip to content

Commit

Permalink
Merge pull request #73 from MinterTeam/dev
Browse files Browse the repository at this point in the history
small improvements and updated version
  • Loading branch information
danil-lashin authored Jul 31, 2018
2 parents 578e5ea + 7d5ac07 commit 502932f
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 10 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

- [api] Add validators rewards to block api

## 0.1.7
*Jule 30th, 2018*

BREAKING CHANGES

- [testnet] New testnet id

IMPROVEMENT

- [validators] Added flag ``--reset-private-validator``
- [testnet] Main validator stake is set to 1 mln MNT by default

## 0.1.6
*Jule 30th, 2018*

Expand Down
16 changes: 16 additions & 0 deletions cmd/minter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ func main() {
os.Exit(1)
}

if *utils.ResetPrivateValidator {
resetFilePV(config.GetConfig().PrivValidatorFile())
}

app := minter.NewMinterBlockchain()
node := startTendermintNode(app)

Expand Down Expand Up @@ -69,3 +73,15 @@ func startTendermintNode(app *minter.Blockchain) *tmNode.Node {

return node
}

func resetFilePV(privValFile string) {
if _, err := os.Stat(privValFile); err == nil {
pv := privval.LoadFilePV(privValFile)
pv.Reset()
log.Info("Reset private validator file to genesis state", "file", privValFile)
} else {
pv := privval.GenFilePV(privValFile)
pv.Save()
log.Info("Generated private validator file", "file", privValFile)
}
}
7 changes: 4 additions & 3 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
)

var (
MinterAPIAddrFlag = flag.String("api_addr", ":8841", "This is the address that minter will use to open API server. Please provide a port.")
MinterHome = flag.String("home", "", "Path to minter data directory")
DisableApi = flag.Bool("disable-api", false, "")
MinterAPIAddrFlag = flag.String("api_addr", ":8841", "This is the address that minter will use to open API server. Please provide a port.")
MinterHome = flag.String("home", "", "Path to minter data directory")
DisableApi = flag.Bool("disable-api", false, "")
ResetPrivateValidator = flag.Bool("reset-private-validator", false, "")
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion core/minter/minter.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (app *Blockchain) InitChain(req abciTypes.RequestInitChain) abciTypes.Respo
}

for _, validator := range req.Validators {
app.stateDeliver.CreateCandidate(genesisState.FirstValidatorAddress, validator.PubKey.Data, 10, 1, types.GetBaseCoin(), big.NewInt(1))
app.stateDeliver.CreateCandidate(genesisState.FirstValidatorAddress, validator.PubKey.Data, 10, 1, types.GetBaseCoin(), helpers.BipToPip(big.NewInt(1000000)))
app.stateDeliver.SetCandidateOnline(validator.PubKey.Data)
app.activeValidators = append(app.activeValidators, validator)
}
Expand Down
6 changes: 3 additions & 3 deletions genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ func GetTestnetGenesis() (*tmtypes.GenesisDoc, error) {
}

genesis := tmtypes.GenesisDoc{
GenesisTime: time.Date(2018, 7, 23, 0, 0, 0, 0, time.UTC),
ChainID: "minter-test-network-16",
GenesisTime: time.Date(2018, 7, 31, 0, 0, 0, 0, time.UTC),
ChainID: "minter-test-network-17",
ConsensusParams: nil,
Validators: []tmtypes.GenesisValidator{
{
PubKey: validatorPubKey,
Power: 100,
Power: 100000000,
},
},
AppHash: common.HexBytes(appHash),
Expand Down
2 changes: 1 addition & 1 deletion log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var (
)

func init() {
logger, _ := flags.ParseLogLevel("consensus:info,state:info,*:error", log.NewTMLogger(os.Stdout), "info")
logger, _ := flags.ParseLogLevel("consensus:info,state:info,main:info,*:error", log.NewTMLogger(os.Stdout), "info")
SetLogger(logger)
}

Expand Down
4 changes: 2 additions & 2 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ package version
const (
Maj = "0"
Min = "1"
Fix = "6"
Fix = "7"
)

var (
// Must be a string because scripts like dist.sh read this file.
Version = "0.1.6"
Version = "0.1.7"

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

0 comments on commit 502932f

Please sign in to comment.