Support unconfirmed tx as output spender.
evoskuil opened this issue · 2 comments
This was intended to be replaced by storing spender height with each output, scanning the block at the given height for the spender.
This is insufficient if we want to be able to provide this response for the set of unconfirmed txs that may have spent the output. By relying on linked confirmation state, as we now do for payment indexing, we can support this on tx write with no need for updates upon reorg. IOW the cost is amortized across the tx pool construction, avoiding post-validation impact. The downside is the very large spenders table.
A better compromise is to create a variable length list for each output, where all spender transactions are referenced from a linked list stored in the tx table (as additional data allocations, so new append for each new spender). Confirmed-ness can be determined through lookup, and remains optimized using spender-height in the output. The first implementation can support confirmed only, adding the linked list in a later release, or it could be done with list only.
Implemented in v4.