zcash / librustzcash

Rust-language assets for Zcash
Other
324 stars 242 forks source link

zcash_client_sqlite wallet will never expire outputs from a tx that has no expiry height, even if it cannot be mined #1426

Open daira opened 1 week ago

daira commented 1 week ago

@daira wrote at https://github.com/zcash/librustzcash/pull/1402#discussion_r1643047443 :

It could be that the spending tx is unmined and will not expire, but is dependent on another transaction that is unmined and will expire.

This is a pre-existing issue. I don't think there's any way to fix it from this side of the lightwalletd protocol. A full node will keep only transactions that could be mined in its mempool (subject also to ZIP 401 if the mempool becomes full), but a light client doesn't have enough information to do that.

This is another reason why I think it's basically unsafe to ever include funds from zero-conf transactions in balances, especially for a light client. The issue is actually more general: depending on an output from another expired transaction is only one reason why a transaction might never be minable.

daira commented 1 week ago

The converse of this issue also applies to TXOs for which a spending transaction is unminable. That may be an inaccessible-funds issue. However, I think it only occurs when sharing a seed with another wallet that produces transactions that never expire.