Hash calculated incorrectly for transactions
garethjns opened this issue · 0 comments
garethjns commented
In transaction class, hash is calculated from incomplete header that contains only the first input and output. This needs to be updated to handle all inputs and outputs.
from pybt.py3.block.Transaction:
def prep_header(self) -> bytes:
"""Return transaction header bytes.
Only works for single input and output transactions for now
"""
header = self._version \
+ self._nInputs \
+ self.txIn[0]._prevOutput \
+ self.txIn[0]._prevIndex \
+ self.txIn[0]._scriptLength \
+ self.txIn[0]._scriptSig \
+ self.txIn[0]._sequence \
+ self._nOutputs \
+ self.txOut[0]._value \
+ self.txOut[0]._pkScriptLen \
+ self.txOut[0]._pkScript \
+ self._lockTime
return header