Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
burrow
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hang Yu
burrow
Commits
fa73526c
Unverified
Commit
fa73526c
authored
8 years ago
by
Silas Davis
Browse files
Options
Downloads
Patches
Plain Diff
Avoid . import and use our version of exit command
parent
7f5c95b7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
manager/eris-mint/state/state.go
+8
-5
8 additions, 5 deletions
manager/eris-mint/state/state.go
util/os.go
+13
-0
13 additions, 0 deletions
util/os.go
with
21 additions
and
5 deletions
manager/eris-mint/state/state.go
+
8
−
5
View file @
fa73526c
...
...
@@ -12,7 +12,6 @@ import (
ptypes
"github.com/eris-ltd/eris-db/permission/types"
"github.com/eris-ltd/eris-db/txs"
.
"github.com/tendermint/go-common"
dbm
"github.com/tendermint/go-db"
"github.com/tendermint/go-events"
"github.com/tendermint/go-merkle"
...
...
@@ -20,6 +19,7 @@ import (
core_types
"github.com/eris-ltd/eris-db/core/types"
"github.com/tendermint/tendermint/types"
"github.com/eris-ltd/eris-db/util"
)
var
(
...
...
@@ -77,7 +77,7 @@ func LoadState(db dbm.DB) *State {
s
.
nameReg
.
Load
(
nameRegHash
)
if
*
err
!=
nil
{
// DATA HAS BEEN CORRUPTED OR THE SPEC HAS CHANGED
Exit
(
Fmt
(
"Data has been corrupted or its spec has changed: %v
\n
"
,
*
err
)
)
util
.
Fatalf
(
"Data has been corrupted or its spec has changed: %v
\n
"
,
*
err
)
}
// TODO: ensure that buf is completely read.
}
...
...
@@ -101,7 +101,10 @@ func (s *State) Save() {
//wire.WriteByteSlice(s.validatorInfos.Hash(), buf, n, err)
wire
.
WriteByteSlice
(
s
.
nameReg
.
Hash
(),
buf
,
n
,
err
)
if
*
err
!=
nil
{
PanicCrisis
(
*
err
)
// TODO: [Silas] Do something better than this, really serialising ought to
// be error-free
util
.
Fatalf
(
"Could not serialise state in order to save the state, "
+
"cannot continue, error: %s"
,
*
err
)
}
s
.
DB
.
Set
(
stateKey
,
buf
.
Bytes
())
}
...
...
@@ -401,7 +404,7 @@ func (s *State) SetFireable(evc events.Fireable) {
func
MakeGenesisStateFromFile
(
db
dbm
.
DB
,
genDocFile
string
)
(
*
GenesisDoc
,
*
State
)
{
jsonBlob
,
err
:=
ioutil
.
ReadFile
(
genDocFile
)
if
err
!=
nil
{
Exit
(
Fmt
(
"Couldn't read GenesisDoc file: %v"
,
err
)
)
util
.
Fatalf
(
"Couldn't read GenesisDoc file: %v"
,
err
)
}
genDoc
:=
GenesisDocFromJSON
(
jsonBlob
)
return
genDoc
,
MakeGenesisState
(
db
,
genDoc
)
...
...
@@ -409,7 +412,7 @@ func MakeGenesisStateFromFile(db dbm.DB, genDocFile string) (*GenesisDoc, *State
func
MakeGenesisState
(
db
dbm
.
DB
,
genDoc
*
GenesisDoc
)
*
State
{
if
len
(
genDoc
.
Validators
)
==
0
{
Exit
(
Fmt
(
"The genesis file has no validators"
)
)
util
.
Fatalf
(
"The genesis file has no validators"
)
}
if
genDoc
.
GenesisTime
.
IsZero
()
{
...
...
This diff is collapsed.
Click to expand it.
util/os.go
0 → 100644
+
13
−
0
View file @
fa73526c
package
util
import
(
"fmt"
"os"
)
// Prints an error message to stderr and exits with status code 1
func
Fatalf
(
format
string
,
args
...
interface
{})
{
fmt
.
Fprintf
(
os
.
Stderr
,
format
,
args
...
)
os
.
Exit
(
1
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment