diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 3e3ac497c9..1d89022876 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -8,6 +8,10 @@ #### General +#### CLI + +- \#3852 Add warning when orchestrator attempts to unbond full stake, requiring confirmation to prevent accidental deactivation (@moudi-network) + #### Broadcaster #### Orchestrator diff --git a/cmd/livepeer_cli/wizard_bond.go b/cmd/livepeer_cli/wizard_bond.go index c9ecd6b381..1bd8a663fd 100644 --- a/cmd/livepeer_cli/wizard_bond.go +++ b/cmd/livepeer_cli/wizard_bond.go @@ -286,6 +286,28 @@ func (w *wizard) unbond() { } } + // Warn if unbonding full amount while being an orchestrator (delegated to self) + if amount.Cmp(dInfo.BondedAmount) == 0 && dInfo.DelegateAddress == dInfo.Address { + fmt.Printf("\nWARNING: You are about to unbond your entire stake.\n") + fmt.Printf("Since you are an orchestrator (delegated to yourself), this will DEACTIVATE your orchestrator.\n") + fmt.Printf("Your orchestrator will no longer be eligible to receive work or rewards until you rebond and reactivate.\n") + fmt.Printf("Are you sure you want to proceed? (y/n) - ") + + confirm := "" + for { + confirm = w.readString() + if confirm == "y" || confirm == "n" { + break + } + fmt.Printf("Enter (y)es or (n)o \n") + } + + if confirm == "n" { + fmt.Printf("Unbond cancelled.\n") + return + } + } + val := url.Values{ "amount": {fmt.Sprintf("%v", amount.String())}, }