Returns whether the input has a valid signature
(self, input_index)
| 199 | return int.from_bytes(h256, 'big') |
| 200 | |
| 201 | def verify_input(self, input_index): |
| 202 | '''Returns whether the input has a valid signature''' |
| 203 | # get the relevant input |
| 204 | tx_in = self.tx_ins[input_index] |
| 205 | # grab the previous ScriptPubKey |
| 206 | script_pubkey = tx_in.script_pubkey(testnet=self.testnet) |
| 207 | # check to see if the ScriptPubkey is a p2sh using |
| 208 | # Script.is_p2sh_script_pubkey() |
| 209 | # the last cmd in a p2sh is the RedeemScript |
| 210 | # prepend the length of the RedeemScript using encode_varint |
| 211 | # parse the RedeemScript |
| 212 | # otherwise RedeemScript is None |
| 213 | # get the signature hash (z) |
| 214 | # pass the RedeemScript to the sig_hash method |
| 215 | z = self.sig_hash(input_index) |
| 216 | # combine the current ScriptSig and the previous ScriptPubKey |
| 217 | combined = tx_in.script_sig + script_pubkey |
| 218 | # evaluate the combined script |
| 219 | return combined.evaluate(z) |
| 220 | |
| 221 | def verify(self): |
| 222 | '''Verify this transaction''' |
no test coverage detected