-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add initializing node height command * update readme * lint * bump opinit version * tidy * delete future withdrawals & trees
- Loading branch information
Showing
19 changed files
with
275 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package executor | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/initia-labs/opinit-bots/node" | ||
"github.com/initia-labs/opinit-bots/types" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func ResetHeights(db types.DB) error { | ||
dbs := []types.DB{ | ||
db.WithPrefix([]byte(types.HostName)), | ||
db.WithPrefix([]byte(types.ChildName)), | ||
db.WithPrefix([]byte(types.BatchName)), | ||
} | ||
|
||
for _, db := range dbs { | ||
if err := node.DeleteSyncInfo(db); err != nil { | ||
return err | ||
} | ||
fmt.Printf("reset height to 0 for node %s\n", string(db.GetPrefix())) | ||
} | ||
return nil | ||
} | ||
|
||
func ResetHeight(db types.DB, nodeName string) error { | ||
if nodeName != types.HostName && | ||
nodeName != types.ChildName && | ||
nodeName != types.BatchName { | ||
return errors.New("unknown node name") | ||
} | ||
nodeDB := db.WithPrefix([]byte(nodeName)) | ||
err := node.DeleteSyncInfo(nodeDB) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Printf("reset height to 0 for node %s\n", string(nodeDB.GetPrefix())) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.