Skip to content

lint(ttx): split gocognit fixes out of #2327 - #2390

Open
atharrva01 wants to merge 1 commit into
LFDT-Panurus:mainfrom
atharrva01:gocognit-split-ttx
Open

atharrva01 wants to merge 1 commit into
LFDT-Panurus:mainfrom
atharrva01:gocognit-split-ttx

Conversation

@atharrva01

Copy link
Copy Markdown
Contributor

Fixes #2382.

First slice of the gocognit split agreed on #2327 (tracking issue #2377): pulls just token/services/ttx's complexity-reduction extraction out into its own reviewable PR, ahead of #2327 itself enabling the linter.

Splits:

  • collectendorsements.go: the signer-strategy branches in requestSignatures (multi-sig, policy, external wallet, local, remote) into named tryXxxSignature helpers, and the distribution-list construction in prepareDistributionList into unwrapDistributionIDs/addPartyToDistributionList/addAuditorToDistributionList/resolveLongTermIdentity.
  • recipients.go: the recipient-identity request/respond/exchange handshakes into per-case helpers.
  • endorse.go, endorse_opts.go, finality.go, finality/listener.go, finality/recovery.go, marshaller.go: smaller, single-purpose extractions.

A couple of view handshakes keep a justified //nolint:gocognit: splitting the decision logic from the response send risks a response that doesn't match what was actually decided, so those stay as one function.

Also fixes a real bug that only showed up in #2327's itest matrix, not in unit tests or lint: the first pass at ExchangeRecipientIdentitiesView.Call's exchangeLocally/exchangeRemotely split dropped the initiator's attestation-signing call, so every cross-node recipient exchange (swap, DVP, HTLC) went out with an empty signature and got rejected. That's restored here and itest-verified on #2327 before this split.

Verified: go build ./..., golangci-lint run (default set) on token/services/ttx/..., go test ./token/services/ttx/..., gofmt -l -s, go vet.

@atharrva01

Copy link
Copy Markdown
Contributor Author

@Effi-S PTAL

@Effi-S
Effi-S self-requested a review September 16, 2026 18:45
@Effi-S Effi-S added this to the Q3/26 milestone Sep 16, 2026
Comment thread token/services/ttx/recipients.go Outdated
@AkramBitar

Copy link
Copy Markdown
Contributor

@atharrva01

Could you please rebase and squash all the commits to one before I will merge it?

Regards,
Akram

Splits token/services/ttx's slice of the gocognit complexity-reduction
sweep out of LFDT-Panurus#2327 into its own PR, per LFDT-Panurus#2382. Extracts the flagged
functions into named helpers along their existing logical boundaries
(signature-collection strategies in collectendorsements.go, the
recipient-identity request/respond/exchange handshakes in
recipients.go, distribution-list construction, finality status
handling, and the request/response marshalling helpers), and adds
justified nolint waivers on the couple of view handshakes where
splitting the decision from the response risks sending back something
that doesn't match what was decided.

This includes a fix that only showed up in LFDT-Panurus#2327's itest matrix: the
first pass at splitting ExchangeRecipientIdentitiesView.Call into
exchangeLocally/exchangeRemotely dropped the initiator's attestation
signing step, so every cross-node recipient exchange (swap, DVP, HTLC)
went out with an empty signature and the responder rejected it. That's
restored here.

Also drops an unreachable wallet-nil check in resolveRecipientIdentity.

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gocognit split: token/services/ttx

3 participants