1
0

transaction: tx_from_any: follow-up: only rm whitespaces from strings

This commit is contained in:
SomberNight
2025-12-11 16:24:31 +00:00
parent 7d307048a0
commit 16363cc3d9
2 changed files with 12 additions and 8 deletions

View File

@@ -276,11 +276,11 @@ class TestTransaction(ElectrumTestCase):
data = raw_tx.data
tx_from_any(data) # test if raises (should not)
else:
mid = len(raw_tx.data) // 2
if isinstance(raw_tx.data, str):
mid = len(raw_tx.data) // 2 # for str, sprinkle whitespaces all over
data = whitespace_str + raw_tx.data[:mid] + whitespace_str + raw_tx.data[mid:] + whitespace_str
else:
data = whitespace_bytes + raw_tx.data[:mid] + whitespace_bytes + raw_tx.data[mid:] + whitespace_bytes
else: # bytes only tolerate whitespaces that are leading/trailing
data = whitespace_bytes + raw_tx.data + whitespace_bytes
if raw_tx.is_whitespace_allowed:
tx_from_any(data) # test if raises (should not)
else: