Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

livepeer_cli: use the O's currently registered Service URI as default address #2416

Merged
merged 1 commit into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
### Bug Fixes 🐞

#### CLI
- \#2416 Use the O's currently registered Service URI as default address (@emranemran)

#### General

Expand Down
16 changes: 13 additions & 3 deletions cmd/livepeer_cli/wizard_transcoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ func myHostPort() string {
// http://whatismyipaddress.com/api
// http://ipinfo.io/ip
ip := strings.TrimSpace(httpGet("https://api.ipify.org/?format=text"))
return ip + ":" + defaultRPCPort
return "https://" + ip + ":" + defaultRPCPort
}

func (w *wizard) promptOrchestratorConfig() (float64, float64, int, int, string) {
var (
blockRewardCut float64
feeCut float64
addr string
)

orch, _, err := w.getOrchestratorInfo()
Expand All @@ -66,13 +67,16 @@ func (w *wizard) promptOrchestratorConfig() (float64, float64, int, int, string)
fmt.Printf("Enter the price for %d pixels in Wei (required) ", pixelsPerUnit)
pricePerUnit := w.readDefaultInt(0)

addr := myHostPort()
if orch.ServiceURI == "" {
addr = myHostPort()
} else {
addr = orch.ServiceURI
}
fmt.Printf("Enter the public host:port of node (default: %v)", addr)
serviceURI := w.readStringAndValidate(func(in string) (string, error) {
if "" == in {
in = addr
}
in = "https://" + in
uri, err := url.ParseRequestURI(in)
if err != nil {
return "", err
Expand Down Expand Up @@ -166,6 +170,12 @@ func (w *wizard) activateOrchestrator() {
}

func (w *wizard) setOrchestratorConfig() {

if w.offchain {
fmt.Println("Cannot set Orchestrator config in off-chain mode")
return
}

fmt.Printf("Current token balance: %v\n", w.getTokenBalance())

val := w.getOrchestratorConfigFormValues()
Expand Down