Cleanup, add stub for VerifyCommitAny
This commit is contained in:
parent
846e6d3bda
commit
67ab574e98
|
@ -34,9 +34,12 @@ func run_node(config cfg.Config) {
|
|||
if err != nil {
|
||||
Exit(Fmt("Couldn't read GenesisDoc file: %v", err))
|
||||
}
|
||||
genDoc := types.GenesisDocFromJSON(jsonBlob)
|
||||
genDoc, err := types.GenesisDocFromJSON(jsonBlob)
|
||||
if err != nil {
|
||||
Exit(Fmt("Error reading GenesisDoc: %v", err))
|
||||
}
|
||||
if genDoc.ChainID == "" {
|
||||
PanicSanity(Fmt("Genesis doc %v must include non-empty chain_id", genDocFile))
|
||||
Exit(Fmt("Genesis doc %v must include non-empty chain_id", genDocFile))
|
||||
}
|
||||
config.Set("chain_id", genDoc.ChainID)
|
||||
}
|
||||
|
|
|
@ -166,7 +166,10 @@ func MakeGenesisStateFromFile(db dbm.DB, genDocFile string) *State {
|
|||
if err != nil {
|
||||
Exit(Fmt("Couldn't read GenesisDoc file: %v", err))
|
||||
}
|
||||
genDoc := types.GenesisDocFromJSON(genDocJSON)
|
||||
genDoc, err := types.GenesisDocFromJSON(genDocJSON)
|
||||
if err != nil {
|
||||
Exit(Fmt("Error reading GenesisDoc: %v", err))
|
||||
}
|
||||
return MakeGenesisState(db, genDoc)
|
||||
}
|
||||
|
||||
|
|
|
@ -38,11 +38,7 @@ func (genDoc *GenesisDoc) SaveAs(file string) error {
|
|||
//------------------------------------------------------------
|
||||
// Make genesis state from file
|
||||
|
||||
func GenesisDocFromJSON(jsonBlob []byte) (genState *GenesisDoc) {
|
||||
var err error
|
||||
wire.ReadJSONPtr(&genState, jsonBlob, &err)
|
||||
if err != nil {
|
||||
Exit(Fmt("Couldn't read GenesisDoc: %v", err))
|
||||
}
|
||||
func GenesisDocFromJSON(jsonBlob []byte) (genDoc *GenesisDoc, err error) {
|
||||
wire.ReadJSONPtr(&genDoc, jsonBlob, &err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -252,6 +252,32 @@ func (valSet *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height
|
|||
}
|
||||
}
|
||||
|
||||
// Verify that +2/3 of this set had signed the given signBytes.
|
||||
// Unlike VerifyCommit(), this function can verify commits with differeent sets.
|
||||
func (valSet *ValidatorSet) VerifyCommitAny(chainID string, blockID BlockID, height int, commit *Commit) error {
|
||||
panic("Not yet implemented")
|
||||
/*
|
||||
Start like:
|
||||
|
||||
FOR_LOOP:
|
||||
for _, val := range vals {
|
||||
if len(precommits) == 0 {
|
||||
break FOR_LOOP
|
||||
}
|
||||
next := precommits[0]
|
||||
switch bytes.Compare(val.Address(), next.ValidatorAddress) {
|
||||
case -1:
|
||||
continue FOR_LOOP
|
||||
case 0:
|
||||
signBytes := tm.SignBytes(next)
|
||||
...
|
||||
case 1:
|
||||
... // error?
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
func (valSet *ValidatorSet) String() string {
|
||||
return valSet.StringIndented("")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue