本文整理汇总了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()))
示例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)