librustzcash
librustzcash copied to clipboard
get_wallet_summary is inconsistent about including funds from mempool txns that can still be mined when min_confirmations == 0
@str4d wrote at https://github.com/zcash/librustzcash/pull/914/files#r1316507311 :
There is a slight issue here regarding notes that are just about to expire. Without the
max(_, 1)
, withmin_confirmations == 0
this would setsummary_height
to the "mempool height" (chain_height + 1
), which is precisely what we want for any transaction in the mempool (that still has a chance of being mined, and thus mined before expiry). Down below in the note selection code, we exclude transactions that have expired as ofsummary_height
(becauseexpiry_height < summary_height
) from the balance, which means if someone calls this API withmin_confirmations == 0
, then about-to-expire funds will disappear from the wallet balance, only to reappear again if the transaction does actually get mined in the last block it can.I'm fine with this being an edge case we don't handle yet, and instead merging @daira's suggested comment change that we treat
min_confirmations == 0
asmin_confirmations == 1
for shielded notes.