MCPcopy
hub / github.com/petertodd/python-bitcoinlib / FindAndDelete

Function FindAndDelete

bitcoin/core/script.py:851–866  ·  view source on GitHub ↗

Consensus critical, see FindAndDelete() in Satoshi codebase

(script, sig)

Source from the content-addressed store, hash-verified

849SIGHASH_ANYONECANPAY = 0x80
850
851def FindAndDelete(script, sig):
852 """Consensus critical, see FindAndDelete() in Satoshi codebase"""
853 r = b''
854 last_sop_idx = sop_idx = 0
855 skip = True
856 for (opcode, data, sop_idx) in script.raw_iter():
857 if not skip:
858 r += script[last_sop_idx:sop_idx]
859 last_sop_idx = sop_idx
860 if script[sop_idx:sop_idx + len(sig)] == sig:
861 skip = True
862 else:
863 skip = False
864 if not skip:
865 r += script[last_sop_idx:]
866 return CScript(r)
867
868def IsLowDERSignature(sig):
869 """

Callers 3

_CheckMultiSigFunction · 0.85
_EvalScriptFunction · 0.85
RawSignatureHashFunction · 0.85

Calls 2

CScriptClass · 0.85
raw_iterMethod · 0.80

Tested by

no test coverage detected