Consensus critical, see FindAndDelete() in Satoshi codebase
(script, sig)
| 702 | return sig |
| 703 | |
| 704 | def FindAndDelete(script, sig): |
| 705 | """Consensus critical, see FindAndDelete() in Satoshi codebase""" |
| 706 | r = b'' |
| 707 | last_sop_idx = sop_idx = 0 |
| 708 | skip = True |
| 709 | for (opcode, data, sop_idx) in script.raw_iter(): |
| 710 | if not skip: |
| 711 | r += script[last_sop_idx:sop_idx] |
| 712 | last_sop_idx = sop_idx |
| 713 | if script[sop_idx:sop_idx + len(sig)] == sig: |
| 714 | skip = True |
| 715 | else: |
| 716 | skip = False |
| 717 | if not skip: |
| 718 | r += script[last_sop_idx:] |
| 719 | return CScript(r) |
| 720 | |
| 721 | def LegacySignatureMsg(script, txTo, inIdx, hashtype, enable_sighash_rangeproof=True): |
| 722 | """Preimage of the signature hash, if it exists. |
no test coverage detected