sweeper: rename Failed to Fatal and minor refactor#9446
Conversation
|
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
e8cb0c7 to
a738e7f
Compare
ellemouton
left a comment
There was a problem hiding this comment.
refactor LGTM! (small rebase artefact nit)
| req *BumpRequest, f FeeFunction) { | ||
|
|
||
| // Register the record. | ||
| t.records.Store(requestID, &monitorRecord{ |
There was a problem hiding this comment.
should we comment somewhere that this should be the only call-site of t.records.Store?
There was a problem hiding this comment.
So there's one other location right now:
Lines 427 to 441 in 0ac5bfa
As is, it's used for initial storage (no fee function set, etc). It's also where the requestID is allocated for the first time.
There was a problem hiding this comment.
yeah we do have two places - one for initializing the record, the other is used to update.
| // The tx is valid, store it. | ||
| t.storeRecord( | ||
| requestID, sweepCtx.tx, req, f, sweepCtx.fee, | ||
| sweepCtx.outpointToTxIndex, |
There was a problem hiding this comment.
Nice simplification (roll in fields already part of sweepCtx).
| req *BumpRequest, f FeeFunction) { | ||
|
|
||
| // Register the record. | ||
| t.records.Store(requestID, &monitorRecord{ |
There was a problem hiding this comment.
So there's one other location right now:
Lines 427 to 441 in 0ac5bfa
As is, it's used for initial storage (no fee function set, etc). It's also where the requestID is allocated for the first time.
|
|
||
| // spendNotifiers is a map of spend notifiers registered for all the | ||
| // inputs. | ||
| spendNotifiers map[wire.OutPoint]*chainntnfs.SpendEvent |
There was a problem hiding this comment.
Added in an earlier commit, and removed here.
| req *BumpRequest, f FeeFunction) { | ||
| // updateRecord updates the given record's tx and fee, and saves it in the | ||
| // records map. | ||
| func (t *TxPublisher) updateRecord(r *monitorRecord, |
This commit renames `Failed` to `Fatal` as it sounds too close to `PublishFailed`. We also wanna emphasize that inputs in this state won't be retried.
This commit shortens the function signature of `storeRecord`, also makes sure we don't call `t.records.Store` directly but always using `storeRecord` instead so it's easier to trace the record creation.
This way we can greatly simplify the method signatures, also paving the upcoming changes where we wanna make it clear when updating the monitorRecord, we only touch a portion of it.
To make it clear we are only updating fields, which will be handy for the following commit where we start tracking for spending notifications.
a738e7f to
b98542b
Compare
Check-picked some commits from the final sweeper fix.
This is a pure refactoring PR to make a following fix easier to implement, the changes are,
FailedtoFatalfor clarity.storeRecordtoupdateRecordfor clarity.