mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 18:15:19 +00:00
18 lines
361 B
Go
18 lines
361 B
Go
package app
|
|
|
|
import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
)
|
|
|
|
// ExportStateToJSON util function to export the app state to JSON
|
|
func ExportStateToJSON(app *App, path string) error {
|
|
fmt.Println("exporting app state...")
|
|
appState, _, err := app.ExportAppStateAndValidators(false, nil)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return ioutil.WriteFile(path, []byte(appState), 0644)
|
|
}
|