def fetch_transaction_index(self, tx_hash, cb): """Fetch the block height that contains a transaction and its index within a block.""" data = serialize.ser_hash(tx_hash) self.send_command( 'blockchain.fetch_transaction_index', data, cb )
def pack_block_index(index): if type(index) == str: assert len(index) == 32 return serialize.ser_hash(index) elif type(index) == int: return struct.pack('<I', index) else: raise ValueError("Unknown index type")
def fetch_transaction(self, tx_hash, cb): """Fetches a transaction by hash.""" data = serialize.ser_hash(tx_hash) self.send_command('blockchain.fetch_transaction', data, cb)
def fetch_block_height(self, blk_hash, cb): """Fetches the height of a block given its hash.""" data = serialize.ser_hash(blk_hash) self.send_command('blockchain.fetch_block_height', data, cb)
def fetch_transaction_index(self, tx_hash, cb): """Fetch the block height that contains a transaction and its index within a block.""" data = serialize.ser_hash(tx_hash) self.send_command('blockchain.fetch_transaction_index', data, cb)
def fetch_block_transaction_hashes(self, tx_hash, cb): """Fetches list of transaction hashes in a block by block hash.""" data = serialize.ser_hash(tx_hash) self.send_command('blockchain.fetch_block_transaction_hashes', data, cb)
def fetch_txpool_transaction(self, tx_hash, cb): """Fetches a transaction by hash from the txpool.""" data = serialize.ser_hash(tx_hash) self.send_command('transaction_pool.fetch_transaction', data, cb)
def fetch_block_transaction_hashes(self, tx_hash, cb): """Fetches list of transaction hashes in a block by block hash.""" data = serialize.ser_hash(tx_hash) self.send_command( 'blockchain.fetch_block_transaction_hashes', data, cb )