@@ -163,13 +163,13 @@ func (n *NodeConn) CtxFunc() context.Context {
163163// NOTE: this function is a callback to be used by the mailbox package during
164164// the mailbox.NewConnData call.
165165func (n * NodeConn ) onRemoteStatic (key * btcec.PublicKey ) error {
166+ remoteKey := key .SerializeCompressed ()
167+
166168ctxt , cancel := context .WithTimeout (
167- context .Background (), time . Second * 10 ,
169+ context .Background (), DefaultStoreTimetout ,
168170)
169171defer cancel ()
170172
171- remoteKey := key .SerializeCompressed ()
172-
173173err := n .store .SetRemotePubKey (
174174ctxt , n .session .PassphraseEntropy , remoteKey ,
175175)
@@ -226,8 +226,12 @@ func (n *NodeConn) onAuthData(data []byte) error {
226226// microseconds, but we can store the correct one here.
227227n .session .Expiry = & expiry
228228
229- ctxb := context .Background ()
230- err = n .store .SetExpiry (ctxb , n .session .PassphraseEntropy , expiry )
229+ ctxt , cancel := context .WithTimeout (
230+ context .Background (), DefaultStoreTimetout ,
231+ )
232+ defer cancel ()
233+
234+ err = n .store .SetExpiry (ctxt , n .session .PassphraseEntropy , expiry )
231235if err != nil {
232236log .Errorf ("unable to set expiry for session(%x): %w" ,
233237n .session .PassphraseEntropy , err )
0 commit comments