darepod: re-expose GetStoredVTXO for harness inspection - #274
Conversation
Restore the harness-only accessor that was introduced in PR #239 and then inadvertently removed during the policy-migration refactor in commit 35dc614 (darepod: wire policy through daemon and CLI). The docs in darepod/CLAUDE.md and darepod/AGENTS.md still reference this method, so the removal left the API surface doc-inconsistent. The server-side darepo integration harness (harness/arkharness.go over in the darepo repo) calls this method to inspect a client daemon's persisted partial-unroll state without reaching into the unexported vtxoStore field across package+repo boundaries. Reflection or widening the field visibility would both violate the "harness does not poke private state" invariant the client CLAUDE.md calls out, so a narrow purpose-scoped accessor is the right shape. No behavior change beyond the accessor itself: it delegates straight to s.vtxoStore.GetVTXO.
There was a problem hiding this comment.
Code Review
This pull request introduces the GetStoredVTXO method to the Server struct in darepod/server.go, which allows test harnesses to inspect locally stored VTXO descriptors. The review feedback suggests improving the implementation by removing unnecessary blank lines and avoiding string concatenation in the error message for better readability.
| func (s *Server) GetStoredVTXO(ctx context.Context, | ||
| outpoint wire.OutPoint) (*vtxo.Descriptor, error) { | ||
|
|
||
| if s.vtxoStore == nil { | ||
| return nil, fmt.Errorf("client daemon VTXO " + | ||
| "store not initialized") | ||
| } | ||
|
|
||
| return s.vtxoStore.GetVTXO(ctx, outpoint) | ||
| } |
There was a problem hiding this comment.
The implementation of GetStoredVTXO contains unnecessary blank lines and string concatenation in the error message. For better readability and searchability of error messages, it's preferred to use a single string literal and follow the formatting conventions used in the rest of the file (e.g., no blank line at the start of a function).
func (s *Server) GetStoredVTXO(ctx context.Context,
outpoint wire.OutPoint) (*vtxo.Descriptor, error) {
if s.vtxoStore == nil {
return nil, fmt.Errorf("client daemon VTXO store not initialized")
}
return s.vtxoStore.GetVTXO(ctx, outpoint)
}client+itest: cooperative leave end-to-end
Summary
Restore the harness-only
GetStoredVTXOaccessor ondarepod.Serverthat was introduced in #239 and then accidentally removed during the
policy-migration refactor in 35dc614 (
darepod: wire policy through daemon and CLI). The docs indarepod/CLAUDE.mdanddarepod/AGENTS.mdstill reference this method, so the removal left the API surface
doc-inconsistent.
Motivation
The server-side integration harness (
harness/arkharness.goin thedarepo repo) needs to inspect a client daemon's persisted
partial-unroll state during itests. Without this accessor:
vtxoStorefield across package+repoboundaries requires reflection or a visibility change, both of which
break the "harness does not poke private daemon state" invariant
that the client
CLAUDE.mdexplicitly calls out;vtxoStoreto an exported field exports the entire*db.VTXOPersistenceStoresurface area when only a single lookup isneeded.
Change
Re-add the 15-line accessor that delegates straight to
s.vtxoStore.GetVTXO(ctx, outpoint). Same shape as the original inPR #239. No other code touched.
Test plan
go build ./darepod/...clean.pr223-followup branch of darepo) run green.