diff --git a/lnc/lnc.go b/lnc/lnc.go index 8eb18f0..2079efd 100644 --- a/lnc/lnc.go +++ b/lnc/lnc.go @@ -163,13 +163,13 @@ func (n *NodeConn) CtxFunc() context.Context { // NOTE: this function is a callback to be used by the mailbox package during // the mailbox.NewConnData call. func (n *NodeConn) onRemoteStatic(key *btcec.PublicKey) error { + remoteKey := key.SerializeCompressed() + ctxt, cancel := context.WithTimeout( - context.Background(), time.Second*10, + context.Background(), DefaultStoreTimetout, ) defer cancel() - remoteKey := key.SerializeCompressed() - err := n.store.SetRemotePubKey( ctxt, n.session.PassphraseEntropy, remoteKey, ) @@ -226,8 +226,12 @@ func (n *NodeConn) onAuthData(data []byte) error { // microseconds, but we can store the correct one here. n.session.Expiry = &expiry - ctxb := context.Background() - err = n.store.SetExpiry(ctxb, n.session.PassphraseEntropy, expiry) + ctxt, cancel := context.WithTimeout( + context.Background(), DefaultStoreTimetout, + ) + defer cancel() + + err = n.store.SetExpiry(ctxt, n.session.PassphraseEntropy, expiry) if err != nil { log.Errorf("unable to set expiry for session(%x): %w", n.session.PassphraseEntropy, err)