From 72889df1ac2ad1f2f9eea9a10160f2a429b2e8cf Mon Sep 17 00:00:00 2001 From: Larry Ruane Date: Thu, 27 Aug 2026 11:38:50 -0600 Subject: [PATCH 1/2] frontend: shorten two comments to one line each The reasoning they carried -- why codes.Unknown is the wrong code for a request the caller must change, and that wallets back off and retry on it -- is already stated in full in the CHANGELOG entry this branch adds, so nothing is lost by leaving one line at each site. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_015DeK7pepamvANHSUUZWBpm --- frontend/frontend_test.go | 5 +---- frontend/service.go | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/frontend/frontend_test.go b/frontend/frontend_test.go index 90a6e4e0..ed3263fc 100644 --- a/frontend/frontend_test.go +++ b/frontend/frontend_test.go @@ -1450,10 +1450,7 @@ func (tg *testgetsubtreeroots) Send(sr *walletrpc.SubtreeRoot) error { return nil } -// An unrecognized ShieldedProtocol is the caller's mistake, so it must arrive as -// InvalidArgument. Returning a bare error made it codes.Unknown -- "something went -// wrong on the server" -- which is the code wallets back off and retry on, for a -// request that can never succeed. +// An unrecognized ShieldedProtocol must arrive as InvalidArgument, not Unknown. func TestGetSubtreeRootsUnknownProtocolIsInvalidArgument(t *testing.T) { testT = t defer resetGlobals() diff --git a/frontend/service.go b/frontend/service.go index 5a2e1c3a..aacf96ae 100644 --- a/frontend/service.go +++ b/frontend/service.go @@ -1008,10 +1008,7 @@ func (s *lwdStreamer) GetSubtreeRoots(arg *walletrpc.GetSubtreeRootsArg, resp wa case walletrpc.ShieldedProtocol_ironwood: break default: - // A status error, like every other rejection of client input here: a bare - // error reaches the client as codes.Unknown, which is the code for "something - // went wrong on the server". Wallets retry that. An unrecognized protocol is - // the caller's to fix, and InvalidArgument is what says so. + // A bare error would reach the client as codes.Unknown, which wallets retry. return status.Errorf(codes.InvalidArgument, "GetSubtreeRoots: unrecognized shielded protocol: %s", arg.ShieldedProtocol) } From d75971e819b2599aa0174f235777aabede404c35 Mon Sep 17 00:00:00 2001 From: Larry Ruane Date: Thu, 27 Aug 2026 11:35:46 -0600 Subject: [PATCH 2/2] frontend, common: name the right functions in two doc comments Both comments named a function other than the one they document, so `go doc` and every editor that reads doc comments attributed them to nothing. `GetTaddressTransactions` was still documented as `GetTaddressTxids`, the name it carried before 8c4c83a split the deprecated RPC out into its own wrapper. Its "NB, this method is misnamed" note goes away with the rename: it described `GetTaddressTxids`, which is still deprecated, still present, and still carries that explanation in full -- along with a link to #426 -- on the wrapper 90 lines below. `addBlockActive` was documented as `DarksideAddBlock`, a name that no longer exists anywhere in the tree. Reported in #524 and #526. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_015DeK7pepamvANHSUUZWBpm --- common/darkside.go | 2 +- frontend/service.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/common/darkside.go b/common/darkside.go index 56fd666d..6c466ecf 100644 --- a/common/darkside.go +++ b/common/darkside.go @@ -182,7 +182,7 @@ func DarksideReset(sa int, bi, cn string, sst, sot, sit uint32) error { return nil } -// DarksideAddBlock adds a single block to the active blocks list. +// addBlockActive adds a single block to the active blocks list. func addBlockActive(blockBytes []byte) error { block := parser.NewBlock() rest, err := block.ParseFromSlice(blockBytes) diff --git a/frontend/service.go b/frontend/service.go index aacf96ae..d02e055b 100644 --- a/frontend/service.go +++ b/frontend/service.go @@ -97,9 +97,8 @@ func (s *lwdStreamer) GetLatestBlock(ctx context.Context, placeholder *walletrpc // address-index scan (GHSA-x4m7-3gpp-xc36, finding 2). const maxTaddrTxBlockSpan = 10_000_000 -// GetTaddressTxids is a streaming RPC that returns transactions that have -// the given transparent address (taddr) as either an input or output. -// NB, this method is misnamed, it does not return txids. +// GetTaddressTransactions is a streaming RPC that returns transactions that +// have the given transparent address (taddr) as either an input or output. func (s *lwdStreamer) GetTaddressTransactions(addressBlockFilter *walletrpc.TransparentAddressBlockFilter, resp walletrpc.CompactTxStreamer_GetTaddressTransactionsServer) error { common.Log.Debugf("gRPC GetTaddressTransactions(%+v)\n", addressBlockFilter) if err := checkTaddress(addressBlockFilter.Address); err != nil {