Fixed a PrivValidator filename == nil bug

This commit is contained in:
Jae Kwon 2014-12-28 02:05:09 -08:00
parent f91665fe07
commit 2405d00ca5
3 changed files with 5 additions and 4 deletions

View File

@ -82,7 +82,7 @@ type TxInput struct {
Amount uint64 // Must not exceed account balance
Sequence uint // Must be 1 greater than the last committed TxInput
Signature Signature // Depends on the PubKey type and the whole Tx
PubKey PubKey // Optional, may be nil
PubKey PubKey // Must not be nil, may be PubKeyNil.
}
func (txIn *TxInput) ValidateBasic() error {

View File

@ -40,7 +40,7 @@ func NewNode() *Node {
// Get PrivValidator
var privValidator *state_.PrivValidator
if _, err := os.Stat(config.PrivValidatorFile()); err == nil {
privValidator = state_.LoadPrivValidator()
privValidator = state_.LoadPrivValidator(config.PrivValidatorFile())
}
// Get PEXReactor

View File

@ -82,8 +82,8 @@ type PrivValidatorJSON struct {
LastStep uint8
}
func LoadPrivValidator() *PrivValidator {
privValJSONBytes, err := ioutil.ReadFile(PrivValidatorFile())
func LoadPrivValidator(filename string) *PrivValidator {
privValJSONBytes, err := ioutil.ReadFile(filename)
if err != nil {
panic(err)
}
@ -112,6 +112,7 @@ func LoadPrivValidator() *PrivValidator {
LastHeight: privValJSON.LastHeight,
LastRound: privValJSON.LastRound,
LastStep: privValJSON.LastStep,
filename: filename,
}
if err != nil {
panic(err)