💬 ajtowns commented on pull request "signet: fixing mining for OP_TRUE challenge":
(https://github.com/bitcoin/bitcoin/pull/29032#discussion_r1756454064)
python assert doesn't need brackets
This could have (rare, but not cryptographically-rare) false positives if the signet commitment value appears within the segwit commitment; could check it correctly with:
```python
from test_framework.script import CScript
def get_signet_commitment(segwit_commitment):
for el in CScript.fromhex(segwit_commitment):
if isinstance(el, bytes) and el[0:4].hex() == SIGNET_COMMITMENT:
return el[4:].hex()
return None
#assert
...
(https://github.com/bitcoin/bitcoin/pull/29032#discussion_r1756454064)
python assert doesn't need brackets
This could have (rare, but not cryptographically-rare) false positives if the signet commitment value appears within the segwit commitment; could check it correctly with:
```python
from test_framework.script import CScript
def get_signet_commitment(segwit_commitment):
for el in CScript.fromhex(segwit_commitment):
if isinstance(el, bytes) and el[0:4].hex() == SIGNET_COMMITMENT:
return el[4:].hex()
return None
#assert
...