1. 执行结果
personal.lockAccount("0xd4c3b95bf0bbf0fd0087062125dd572114ded44f")
true
2.
2.1. go-ethereum/internal/ethapi/api.go
func (s *PrivateAccountAPI) LockAccount(addr common.Address) bool {
return fetchKeystore(s.am).Lock(addr) == nil
}
2.1 go-ethereum/accounts/keystore/keystore.go
func (ks *KeyStore) Lock(addr common.Address) error {
ks.mu.Lock()
if unl, found := ks.unlocked[addr]; found {
ks.mu.Unlock()
ks.expire(addr, unl, time.Duration(0)*time.Nanosecond) //从unlocked移除
} else {
ks.mu.Unlock()
}
return nil
}