Browse Source

Fixed a PrivValidator filename == nil bug

pull/9/head
Jae Kwon 10 years ago
parent
commit
2405d00ca5
3 changed files with 5 additions and 4 deletions
  1. +1
    -1
      block/tx.go
  2. +1
    -1
      cmd/daemon.go
  3. +3
    -2
      state/priv_validator.go

+ 1
- 1
block/tx.go 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 {


+ 1
- 1
cmd/daemon.go 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


+ 3
- 2
state/priv_validator.go 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)


Loading…
Cancel
Save