lukechampine / walrus

A wallet server for Sia
https://lukechampine.com/docs/walrus
MIT License
12 stars 0 forks source link

Include block height of each UTXO #6

Open lukechampine opened 5 years ago

lukechampine commented 5 years ago

Without this information, it is difficult to determine which UTXOs are "safe" to use. It might also be helpful to include the txid and/or block ID that created the output. I imagine this would be accomplished the same way as #4.

lukechampine commented 5 years ago

Hmm. This is tricky because the modules.ConsensusChange doesn't tell us which transaction an output came from. I suppose we need to do it indirectly instead: look up the transactions associated with the output's unlock hash, then search for the transaction that created this specific output, and use its block height. It seems that this is how siad does it. Not very efficient, but maybe the performance is acceptable. We could amortize the cost by having the Store perform this as soon as the output is added; that's probably the way to go, although it splits responsibilities in a way that I'm not super happy with. (Generally, the Store shouldn't need to do additional processing of the information given to it by FilterConsensusChange.)