Read sapling activation height from RPC

This commit is contained in:
Aditya Kulkarni
2019-09-18 20:38:59 -07:00
parent b2389b6c12
commit 7bf4a8407b
2 changed files with 76 additions and 37 deletions

View File

@@ -58,7 +58,7 @@ func CreateTables(conn *sql.DB) error {
// TODO consider max/count queries instead of state table. bit of a coupling assumption though.
func GetCurrentHeight(ctx context.Context, db *sql.DB) (int, error) {
var height int
var height int = -1
query := "SELECT current_height FROM state WHERE rowid = 1"
err := db.QueryRowContext(ctx, query).Scan(&height)
return height, err