node: expose peer payment history (Node::list_payments) #119
Loading…
Reference in a new issue
No description provided.
Delete branch "onionwire/t_21787cec-node-expose-peer-payment-history-node-li"
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?
Closes the one capability card t_8bb1bac9 found unreachable: peer payment history.
Store::list_payments(src/store.rs:953) was called only fromsrc/node.rs's own tests. There was no accessor, so the TUI's payment view could only show the wallet's own transfer list; the signed/payinvoices and/tipreceipts a peer sent were invisible.API for the TUI card
Paymentisstore::Payment(src/store.rs:94), re-exported nowhere else; the TUI already reachesstoretypes throughnode's public API the same waylist_messages->Messagedoes.payments.idascending (oldest first) and carryid, dir, kind, amount_atomic, address, memo, txid, verified, created_at.Ok(vec![]), not an error.Payment's shape is untouched.memois peer-signed text stored as it arrived; the renderer sanitizes it withsanitize::display_textat draw time, exactly as it already does forMessage::plaintextinsrc/tui.rs:313. The accessor adds no second display path.Tests
cargo test --locked— all targets green, 0 failed. New testnode::tests::list_payments_round_trips_a_peers_invoice_and_receipt(RED first:E0599 no method named list_payments found for struct node::Node, naming both call sites) stores an inbound invoice and an inbound receipt throughStore::insert_payment, then asserts the accessor returns both in id order with the stored fields, and that a befriend'd friend with no rows yields an empty vector.cargo clippy --locked --all-targets -- -D warnings— clean.rustfmt --edition 2024 --check src/node.rs— 0 diffs, same asgit show HEAD:src/node.rs(no inherited churn, none introduced).Only
src/node.rschanged (+82/-1): the accessor, thePaymentimport, and the test. Built withCARGO_TARGET_DIR=/var/tmp/onionwire-tui-target(warm) andTMPDIR=/var/tmp/onionwire-tui-tmp.paymentsrow (key p) #121