lhartikk / naivecoin

A tutorial for building a cryptocurrency
https://lhartikk.github.io/
Apache License 2.0
531 stars 266 forks source link

Redundant Validity check. #21

Open jfsuarezb opened 4 years ago

jfsuarezb commented 4 years ago

https://github.com/lhartikk/naivecoin/blob/35237fbdedd703126bf9baea1d335b9bc2e12fb4/src/transaction.ts#L162

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?

qwertyuu commented 2 years ago

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