Skip to content
Merged
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
25 changes: 19 additions & 6 deletions mobile/mobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,16 @@ func ConnectServer(nameSpace string, mailboxServer string, isDevServer bool,
return
}

mc.mutex.Lock()
defer mc.mutex.Unlock()

statusChecker, lndConnect, err := core.MailboxRPCConnection(
mailboxServer, pairingPhrase, localPriv, remotePub,
func(key *btcec.PublicKey) error {
mc.mutex.Lock()
defer mc.mutex.Unlock()

mc.remoteKeyReceiveCallback.SendResult(
hex.EncodeToString(key.SerializeCompressed()),
hex.EncodeToString(
key.SerializeCompressed(),
),
)

return nil
Expand All @@ -228,23 +230,34 @@ func ConnectServer(nameSpace string, mailboxServer string, isDevServer bool,
"macaroon: %v", err)
}

mc.mac = mac
mc.mutex.Lock()
defer mc.mutex.Unlock()

mc.mac = mac
mc.authDataCallback.SendResult(string(data))

return nil
},
)
if err != nil {
log.Errorf("Error running wasm client: %v", err)
return
}

mc.mutex.Lock()
mc.statusChecker = statusChecker
mc.lndConn, err = lndConnect()
mc.mutex.Unlock()

lndConn, err := lndConnect()
if err != nil {
log.Errorf("Error running wasm client: %v", err)
return
}

mc.mutex.Lock()
mc.lndConn = lndConn
mc.mutex.Unlock()

log.Debugf("Mobile client connected to RPC")
}()

Expand Down