lhartikk / naivecoin

A tutorial for building a cryptocurrency

Home Page:https://lhartikk.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redundant Validity check.

jfsuarezb opened this issue · comments

aUnspentTxOuts.find((uTxO) => uTxO.txOutId === txIn.txOutId && uTxO.txOutIndex === txIn.txOutIndex);

Why is the equality between the unspent transaction id and the new transaction uxto reference id being checked for twice? Why can't you just do uTxO.txOutId === txIn.txOutId instead of uTxO.txOutId === txIn.txOutId && uTxO.txOutId === txIn.txOutId?

They might have wanted to say uTxO.TxOutIndex == txIn.TxOutIndex && uTxO.TxId == txIn.TxId