node: read-only Node::list_payments(friend_pk) for the TUI payment history #78
Loading…
Reference in a new issue
No description provided.
Delete branch "wt/t_6fb6d365"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Exposes the store's existing payment query to the TUI as one typed read method.
The tui-design payment-history card (t_935bf84e) depends on this method: it is the only way src/tui.rs gets payment rows, and that card is blocked on it landing.
What
on
impl Node, delegating toStore::list_payments. Read-only: no schema change, no migration, no new column, no new frame, nodocs/PROTOCOL.mdchange, and no store handle becomes reachable from the TUI.store::Paymentas-is: id, dir, kind, amount_atomic, address, memo, txid (Option), verified, created_at.Result<_, String>style as the neighbouringlist_messages/wallet_recent_transfers. No new error type.Ok(vec![]). An unknown friend isOk(vec![])too, not an error.Test placement (deliberate deviation from the card)
The card asked for the test in
tests/pay.rs. That is not possible for aNodemethod:Node::start/Node::start_with_passphraseare the only public constructors and both bootstrap Tor,ingest_receiptis private, andtests/pay.rsis an integration test against the public API. So the test lives insrc/node.rs's existing#[cfg(test)] mod tests, using an unbootstrapped Arti client and a null deliverer over a real encrypted store in a temp dir. It writes the outbound row directly (the shapepay_invoicewrites) and drives the inbound row through the node's owningest_receipt.TDD evidence
RED first, with the method removed:
GREEN after adding it:
The test asserts both rows with dir in in/out, kind, amount_atomic, address, memo, txid and verified matching what was written, plus
Ok(vec![])for an unknown 32-byte pubkey.Verification
Only
src/node.rsis touched (124 insertions, 1 deletion).crates/onionwire-sdkis a separate workspace and was neither touched nor rebuilt. No repo-widecargo fmt:rustfmt --edition 2024 --check src/node.rsreports the same 6 inherited hunks as the base branch, line-shifted only, so the added code is format-clean.