pybit/py3/block.py
def api_verify(self,
                   url: str="https://blockchain.info/rawblock/",
                   wait: bool=False) -> None:
        """Validate block against blockchain.info.

        Query a block hash from Blockchain.info's api. Check it matches the
        block on size, merkle root, number of transactions, previous block hash.

        Respects APIs request limting queries to 1 every 10s. If wait is True,
        waits to query. If false, skips.

        TODO:
            - Tidy printing
        """
        if self.verb > 4:
            print("{0}{1}Validating{1}".format(" "*3,
                                               "_"*10))

        jr = self.api_get(url=url,
                          wait=wait)

        if jr is not None:
            # Use these fields for validation
            validationFields = {
                self.hash: jr['hash'],
                self.blockSize: jr['size'],
                self.merkleRootHash: jr['mrkl_root'],
                self.nTransactions: jr['n_tx'],
                self.prevHash: jr['prev_block'],
                self.nonce: jr['nonce'],
                self.timestamp: jr['time']}

            self.api_validated = self.api_check(jr, validationFields)
        else:
            self.api_validated = 'Skipped'

        # Report
        if self.verb > 3:
            print(f"{' '*3}Validation passed: {self.api_validated}",
                  f"\n{' '*3}{'_'*30}")
Validate block against blockchain.info.

        Query a block hash from Blockchain.info's api. Check it matches the
        block on size, merkle root, number of transactions, previous block hash.

        Respects APIs request limting queries to 1 every 10s. If wait is True,
        waits to query. If false, skips.

        TODO:
            - Tidy printing
        


Respects APIs request limting queries to 1 every 10s. If wait is True,
waits to query. If false, skips.

Tidy printing
Respects APIs request limting queries to 1 every 10s . If wait is True waits to query . If false skips . Tidy printing
def api_verify(self,
                   url: str="https://blockchain.info/rawblock/",
                   wait: bool=False) -> None:
        if self.verb > 4:
            print("{0}{1}Validating{1}".format(" "*3,
                                               "_"*10))
        jr = self.api_get(url=url,
                          wait=wait)
        if jr is not None:
            validationFields = {
                self.hash: jr['hash'],
                self.blockSize: jr['size'],
                self.merkleRootHash: jr['mrkl_root'],
                self.nTransactions: jr['n_tx'],
                self.prevHash: jr['prev_block'],
                self.nonce: jr['nonce'],
                self.timestamp: jr['time']}
            self.api_validated = self.api_check(jr, validationFields)
        else:
            self.api_validated = 'Skipped'
        if self.verb > 3:
            print(f"{' '*3}Validation passed: {self.api_validated}",
                  f"\n{' '*3}{'_'*30}")
def api_verify ( self , url : str = "https://blockchain.info/rawblock/" , wait : bool = False ) -> None : if self . verb > 4 : print ( "{0}{1}Validating{1}" . format ( " " * 3 , "_" * 10 ) ) jr = self . api_get ( url = url , wait = wait ) if jr is not None : validationFields = { self . hash : jr [ 'hash' ] , self . blockSize : jr [ 'size' ] , self . merkleRootHash : jr [ 'mrkl_root' ] , self . nTransactions : jr [ 'n_tx' ] , self . prevHash : jr [ 'prev_block' ] , self . nonce : jr [ 'nonce' ] , self . timestamp : jr [ 'time' ] } self . api_validated = self . api_check ( jr , validationFields ) else : self . api_validated = 'Skipped' if self . verb > 3 : print ( f"{' '*3}Validation passed: {self.api_validated}" , f"\n{' '*3}{'_'*30}" )
Validate block against blockchain.info.
Validate block against blockchain . info .
"""Validate block against blockchain.info.

        Query a block hash from Blockchain.info's api. Check it matches the
        block on size, merkle root, number of transactions, previous block hash.

        Respects APIs request limting queries to 1 every 10s. If wait is True,
        waits to query. If false, skips.

        TODO:
            - Tidy printing
        """ # Use these fields for validation # Report
self
url
str
wait
bool