move getPriv to server.go, and rename
This commit is contained in:
parent
4366b1b114
commit
7ecbb2debc
14
rpcserver.go
14
rpcserver.go
@ -105,20 +105,6 @@ func (r *rpcServer) Stop() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getPriv gets the identity private key out of the wallet DB
|
|
||||||
func getPriv(l *lnwallet.LightningWallet) (*btcec.PrivateKey, error) {
|
|
||||||
adr, err := l.ChannelDB.GetIdAdr()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
fmt.Printf("got ID address: %s\n", adr.String())
|
|
||||||
adr2, err := l.Manager.Address(adr)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
priv, err := adr2.(waddrmgr.ManagedPubKeyAddress).PrivKey()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
fmt.Printf("got privkey %x\n", priv.Serialize()) // may want to remove this :)
|
fmt.Printf("got privkey %x\n", priv.Serialize()) // may want to remove this :)
|
||||||
return priv, nil
|
return priv, nil
|
||||||
|
20
server.go
20
server.go
@ -132,3 +132,23 @@ func (s *server) Stop() error {
|
|||||||
close(s.quit)
|
close(s.quit)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getIdentityPrivKey gets the identity private key out of the wallet DB.
|
||||||
|
func getIdentityPrivKey(l *lnwallet.LightningWallet) (*btcec.PrivateKey, error) {
|
||||||
|
adr, err := l.ChannelDB.GetIdAdr()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
fmt.Printf("got ID address: %s\n", adr.String())
|
||||||
|
adr2, err := l.Manager.Address(adr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
fmt.Println("pubkey: %v", hex.EncodeToString(adr2.(waddrmgr.ManagedPubKeyAddress).PubKey().SerializeCompressed()))
|
||||||
|
priv, err := adr2.(waddrmgr.ManagedPubKeyAddress).PrivKey()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return priv, nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user