1616 App ,
1717)
1818from txstratum .manager import TxMiningManager
19- from txstratum .middleware import VERSION_CHECK_ERROR_MESSAGE
19+ from txstratum .middleware import (
20+ HEADER_SKIP_VERSION_CHECK_KEY ,
21+ HEADER_SKIP_VERSION_CHECK_VALUE ,
22+ VERSION_CHECK_ERROR_MESSAGE ,
23+ )
2024from txstratum .utils import tx_or_block_from_bytes
2125
2226from .tx_examples import INVALID_TX_DATA
@@ -488,6 +492,10 @@ async def test_submit_job_fail_script_data26_non_standard(self):
488492
489493 @unittest_run_loop
490494 async def test_check_wallet_version (self ):
495+ header_skip_version_check = {
496+ HEADER_SKIP_VERSION_CHECK_KEY : HEADER_SKIP_VERSION_CHECK_VALUE
497+ }
498+
491499 tx_hex = update_timestamp (TX_SCRIPT_DATA25 ).hex ()
492500
493501 header_desktop_lower = {
@@ -540,6 +548,16 @@ async def test_check_wallet_version(self):
540548 else :
541549 self .assertEqual (200 , resp .status )
542550
551+ # Success always with skip version check header
552+ resp = await self .client .request (
553+ "POST" ,
554+ "/submit-job" ,
555+ json = {"tx" : tx_hex },
556+ headers = {** header_desktop_lower , ** header_skip_version_check },
557+ )
558+ await resp .json ()
559+ self .assertEqual (200 , resp .status )
560+
543561 header_mobile_lower = {"User-Agent" : "Hathor Wallet Mobile / 0.18.0" }
544562 header_mobile_equal = {"User-Agent" : "Hathor Wallet Mobile / 1.18.3" }
545563 header_mobile_higher = {"User-Agent" : "Hathor Wallet Mobile / 20.1.0" }
@@ -577,6 +595,16 @@ async def test_check_wallet_version(self):
577595 else :
578596 self .assertEqual (200 , resp .status )
579597
598+ # Success always with skip version check header
599+ resp = await self .client .request (
600+ "POST" ,
601+ "/submit-job" ,
602+ json = {"tx" : tx_hex },
603+ headers = {** header_mobile_lower , ** header_skip_version_check },
604+ )
605+ await resp .json ()
606+ self .assertEqual (200 , resp .status )
607+
580608 # Error with mobile version before v0.18.0, if the app is validating mobile version
581609 resp = await self .client .request (
582610 "POST" , "/submit-job" , json = {"tx" : tx_hex }, headers = header_mobile_custom
@@ -594,6 +622,16 @@ async def test_check_wallet_version(self):
594622 else :
595623 self .assertEqual (200 , resp .status )
596624
625+ # Success always with skip version check header
626+ resp = await self .client .request (
627+ "POST" ,
628+ "/submit-job" ,
629+ json = {"tx" : tx_hex },
630+ headers = {** header_mobile_custom , ** header_skip_version_check },
631+ )
632+ await resp .json ()
633+ self .assertEqual (200 , resp .status )
634+
597635 # Success if the custom is different than expected
598636 resp = await self .client .request (
599637 "POST" ,
@@ -639,6 +677,16 @@ async def test_check_wallet_version(self):
639677 else :
640678 self .assertEqual (200 , resp .status )
641679
680+ # Success always with skip version check header
681+ resp = await self .client .request (
682+ "POST" ,
683+ "/submit-job" ,
684+ json = {"tx" : tx_hex },
685+ headers = {** header_headless_lower , ** header_skip_version_check },
686+ )
687+ await resp .json ()
688+ self .assertEqual (200 , resp .status )
689+
642690 header_headless_wrong1 = {"User-Agent" : "Hathor Wallet Headless / 0.xx.88" }
643691 header_headless_wrong2 = {"User-Agent" : "Hathor Wallet Headless / 0.14.88beta" }
644692
0 commit comments