-
Notifications
You must be signed in to change notification settings - Fork 122
loopout: ignore saved HTLC txid, add an option to skip some HTLC transactions #958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hieblmi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the quick fix @starius. Iiuc this provids a fix for the current set of clients that have the precondition where different versions of batches were reorg'd, but not for future occurrences of this scenario, correct?
Just in case future clients might have to use SkippedTxs maybe it would be easier to persist the affected txns to the db and load it on restart rather than having it as a command flag to loopd or in a section of the config file.
| LoopOutMaxParts uint32 | ||
|
|
||
| // SkippedTxs is the list of existing HTLC txids to skip when starting | ||
| // Loop. This should only be used if affected by the historical bug. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe mention reorg here, so the historical reorg bug. Should we also include reorg here to make it easier to understand, like SkippedReorgdTxns?
client.go
Outdated
| } | ||
|
|
||
| if len(cfg.SkippedTxs) != 0 { | ||
| skippedTxs := make(map[chainhash.Hash]struct{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think usually we name it txns instead of txs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
loopd/config.go
Outdated
|
|
||
| LoopOutMaxParts uint32 `long:"loopoutmaxparts" description:"The maximum number of payment parts that may be used for a loop out swap."` | ||
|
|
||
| SkippedTxs []string `long:"skippedtxs" description:"The list of existing HTLC txids to skip when starting Loop. This should only be used if affected by the historical bug."` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this only need to be provided once on a restart and can then be skipped for future runs of loopd. Maybe we document the requirement here.
Could we also add a section for this new value in the sample-loopd.conf?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option is intended for testing mostly. It is not expected to be set in prod. I added hidden:"true" to it.
If a reorg happens, the saved txid prevents loop-out from discoveing new txid.
Added option WithSkippedTxns, which has one historical problematic tx by default. Sweeps originating from these transactions are omitted when reading from DB. loopdb: add column sweep_batches.cancelled and replaced DropBatch with CancelBatch. It is needed, because sweep.batch_id is a foreign key to batch. Changed StoreMock.InsertSweepBatch not to reuse batch_id. This is needed by the test, which checks that new batch has fresh ID.
sputn1ck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the fix
hieblmi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
If a reorg happens, the saved txid prevents loop-out from discoveing new txid. So do not use this data after restart.
Added option WithSkippedTxns, which has one historical problematic tx by default. Sweeps originating from these transactions are omitted when reading from DB.
loopdb: add column sweep_batches.cancelled and replaced DropBatch with CancelBatch. It is needed, because sweep.batch_id is a foreign key to batch.
Changed StoreMock.InsertSweepBatch not to reuse batch_id. This is needed by the test, which checks that new batch has fresh ID.
Pull Request Checklist
release_notes.mdif your PR contains major features, breaking changes or bugfixes