当前位置: 首页>>代码示例>>Python>>正文


Python Account.get_expiry方法代码示例

本文整理汇总了Python中models.Account.get_expiry方法的典型用法代码示例。如果您正苦于以下问题:Python Account.get_expiry方法的具体用法?Python Account.get_expiry怎么用?Python Account.get_expiry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Account的用法示例。


在下文中一共展示了Account.get_expiry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_unprocessed

# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_expiry [as 别名]
def check_unprocessed(top_height):
    for tx_hash in unprocessed_txs.members():
        txid = hash_to_hex(tx_hash).decode()
        tx = Tx.tx_from_hex(txs[tx_hash].decode())
        tx_blockchain = get_tx(txid)
        logging.info('Checking %s' % txid)
        if tx_blockchain.block_height == -1:
            continue
        if top_height - tx_blockchain.block_height + 1 >= REQUIRED_CONFIRMATIONS:  # off by one error - if tx in top block that is 1 conf
            unprocessed_txs.remove(tx_hash)
            for out in tx.txs_out:
                address = out.bitcoin_address()
                if address not in all_addresses:
                    continue
                account = Account(addr_to_uid[address])
                satoshis = out.coin_value
                satoshis = int(satoshis / (1 + account.tip.get()))  # scale for tip
                account.total_coins.incr(satoshis)
                node_minutes_d = calc_node_minutes(satoshis, exchange_rate=exchange_rate.get())
                account.total_minutes.incr(node_minutes_d)
                total_nodeminutes.incr(node_minutes_d)
                nodes_recently_updated.append(account.uid)
                account.add_msg('Detected payment via txid: %s' % (txid,))
                account.add_msg('Increased total paid by %.8f to %.8f (considering tip of %d %%)' % (satoshis / COIN, account.total_coins.get() / COIN, account.tip.get() * 100))
                account.add_msg('Increased node life by %d minutes; expiring around %s' % (node_minutes_d, account.get_expiry().isoformat()))
开发者ID:XertroV,项目名称:nodeup-xk-io,代码行数:27,代码来源:monitor_payments.py

示例2: hash_to_hex

# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_expiry [as 别名]
            time.sleep(10)  # only do this at most once per block
            continue
        logging.info('Latest block: %s' % best_block_hash)

        for tx_hash in unprocessed_txs.members():
            txid = hash_to_hex(tx_hash).decode()
            tx = Tx.tx_from_hex(txs[tx_hash].decode())
            tx_blockchain = get_tx(txid)
            logging.info('Checking %s' % txid)
            if tx_blockchain.block_height == -1:
                continue
            if top_height - tx_blockchain.block_height + 1 >= REQUIRED_CONFIRMATIONS:  # off by one error - if tx in top block that is 1 conf
                unprocessed_txs.remove(tx_hash)
                for out in tx.txs_out:
                    address = out.bitcoin_address()
                    if address not in all_addresses:
                        continue
                    account = Account(addr_to_uid[address])
                    satoshis = out.coin_value
                    satoshis = int(satoshis / (1 + account.tip.get()))  # scale for tip
                    account.total_coins.incr(satoshis)
                    node_minutes_d = calc_node_minutes(satoshis, exchange_rate=exchange_rate.get())
                    account.total_minutes.incr(node_minutes_d)
                    total_nodeminutes.incr(node_minutes_d)
                    nodes_recently_updated.append(account.uid)
                    account.add_msg('Detected payment via txid: %s' % (txid,))
                    account.add_msg('Increased total paid by %.8f to %.8f (considering tip of %d %%)' % (satoshis / COIN, account.total_coins.get() / COIN, account.tip.get() * 100))
                    account.add_msg('Increased node life by %d minutes; expiring around %s' % (node_minutes_d, account.get_expiry().isoformat()))

        last_block_checked.set(best_block_hash)
        logging.info('Checked: %s' % best_block_hash)
开发者ID:rnicoll,项目名称:nodeup-xk-io,代码行数:33,代码来源:monitor_payments.py


注:本文中的models.Account.get_expiry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。