mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-23 04:03:49 +00:00
unlocking coinbase
- extract accounts.getKey method - if given empty address it retrieves coinbase (first account) - cli -unlock coinbase will unlock coinbase
This commit is contained in:
parent
859f1f08ca
commit
fd8d18ec28
@ -101,6 +101,17 @@ func (am *Manager) firstAddr() ([]byte, error) {
|
|||||||
return addrs[0], nil
|
return addrs[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (am *Manager) getKey(addr []byte, keyAuth string) (*crypto.Key, error) {
|
||||||
|
if len(addr) == 0 {
|
||||||
|
var err error
|
||||||
|
addr, err = am.firstAddr()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return am.keyStore.GetKey(addr, keyAuth)
|
||||||
|
}
|
||||||
|
|
||||||
func (am *Manager) DeleteAccount(address []byte, auth string) error {
|
func (am *Manager) DeleteAccount(address []byte, auth string) error {
|
||||||
return am.keyStore.DeleteKey(address, auth)
|
return am.keyStore.DeleteKey(address, auth)
|
||||||
}
|
}
|
||||||
@ -119,7 +130,7 @@ func (am *Manager) Sign(a Account, toSign []byte) (signature []byte, err error)
|
|||||||
// TimedUnlock unlocks the account with the given address.
|
// TimedUnlock unlocks the account with the given address.
|
||||||
// When timeout has passed, the account will be locked again.
|
// When timeout has passed, the account will be locked again.
|
||||||
func (am *Manager) TimedUnlock(addr []byte, keyAuth string, timeout time.Duration) error {
|
func (am *Manager) TimedUnlock(addr []byte, keyAuth string, timeout time.Duration) error {
|
||||||
key, err := am.keyStore.GetKey(addr, keyAuth)
|
key, err := am.getKey(addr, keyAuth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -132,7 +143,7 @@ func (am *Manager) TimedUnlock(addr []byte, keyAuth string, timeout time.Duratio
|
|||||||
// stays unlocked until the program exits or until a TimedUnlock
|
// stays unlocked until the program exits or until a TimedUnlock
|
||||||
// timeout (started after the call to Unlock) expires.
|
// timeout (started after the call to Unlock) expires.
|
||||||
func (am *Manager) Unlock(addr []byte, keyAuth string) error {
|
func (am *Manager) Unlock(addr []byte, keyAuth string) error {
|
||||||
key, err := am.keyStore.GetKey(addr, keyAuth)
|
key, err := am.getKey(addr, keyAuth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ Exports the given account's private key into keyfile using the canonical EC form
|
|||||||
The account needs to be unlocked, if it is not the user is prompted for a passphrase to unlock it.
|
The account needs to be unlocked, if it is not the user is prompted for a passphrase to unlock it.
|
||||||
For non-interactive use, the password can be specified with the --unlock flag:
|
For non-interactive use, the password can be specified with the --unlock flag:
|
||||||
|
|
||||||
ethereum --unlock <passwrdfile> account export <address> <keyfile>
|
ethereum --password <passwrdfile> account export <address> <keyfile>
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
Since you can directly copy your encrypted accounts to another ethereum instance, this import/export mechanism is not needed when you transfer an account between nodes.
|
Since you can directly copy your encrypted accounts to another ethereum instance, this import/export mechanism is not needed when you transfer an account between nodes.
|
||||||
@ -305,6 +305,9 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
|
|||||||
|
|
||||||
account := ctx.GlobalString(utils.UnlockedAccountFlag.Name)
|
account := ctx.GlobalString(utils.UnlockedAccountFlag.Name)
|
||||||
if len(account) > 0 {
|
if len(account) > 0 {
|
||||||
|
if account == "coinbase" {
|
||||||
|
account = ""
|
||||||
|
}
|
||||||
unlockAccount(ctx, am, account)
|
unlockAccount(ctx, am, account)
|
||||||
}
|
}
|
||||||
// Start auxiliary services if enabled.
|
// Start auxiliary services if enabled.
|
||||||
|
Loading…
Reference in New Issue
Block a user