Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

staticaddr/deposit: separate generic OnError from caller-held rollback events

オープン
#1,168 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
go
領域
backend

調査の方向性

まず updateDeposit、lockedEvents、TransitionDeposits を追跡し、次に deposit FSM のアクションである PublishDepositExpirySweepAction と WaitForExpirySweepAction を調査します。呼び出し元が保持するロールバックイベントを汎用の fsm.OnError から分離し、内部で生成されたエラーが deposit lock を取得する一方で、manager によって実行されるロールバックでは二重ロックを避けられるようにします。両方の経路が、誤った lock の前提に依存せず、意図した状態と store の更新を維持できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Problem

The static-address deposit FSM currently treats fsm.OnError as if it always arrives while the caller already holds the deposit lock.

That assumption is not reliable. Some fsm.OnError transitions do come from TransitionDeposits, where the manager locks deposits before sending the event. But deposit FSM actions can also emit fsm.OnError internally. Examples include:

  • PublishDepositExpirySweepAction returning fsm.OnError after expiry sweep publish failures;
  • WaitForExpirySweepAction returning fsm.OnError after notifier or context errors.

Those internal paths originate from the deposit FSM's own block handling, so no external deposit lock is held.

Because fsm.OnError is in lockedEvents, updateDeposit can skip acquiring the deposit lock, call no-lock state mutation helpers, and update the store under an assumption that is false for internally generated errors.

This was discussed during PR #1161: https://github.com/lightninglabs/loop/pull/1161#discussion_r3539803146

The issue appears to predate PR #1161, but that PR touched the surrounding deposit locking/lifecycle code and made the invariant visible.

Potential fix

Do not use the generic fsm.OnError event to also mean "caller-held rollback/unlock to Deposited".

One possible shape:

  • introduce a deposit-specific rollback event, for example OnReleaseDeposit or OnDepositRollback;
  • use that event from manager-driven TransitionDeposits callers that already hold deposit locks and need to move selected deposits back to Deposited;
  • include that specific rollback event in lockedEvents;
  • remove generic fsm.OnError from lockedEvents, so internally generated errors acquire the deposit lock inside updateDeposit;
  • keep fsm.OnError as the generic action-error transition in the deposit FSM, not as an implicit lock-state signal.

That separates event meaning from caller locking context: events sent by TransitionDeposits can still avoid double-locking, while internally generated fsm.OnError paths no longer run no-lock state/store updates without a held deposit lock.

主要言語
Go
スター
593
フォーク
138
平均マージ
4日 18時間
マージ済み PR(30日)
20

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

lightninglabs/loop のほかの issue

lightninglabs/loop の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。