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


Python Block.is_valid方法代码示例

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


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

示例1: validate_possible_block

# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import is_valid [as 别名]
def validate_possible_block(possible_block_dict):

  possible_block = Block(possible_block_dict)
  if possible_block.is_valid():
    possible_block.self_save()

    #we want to kill and restart the mining block so it knows it lost
    sched.print_jobs()
    try:
      sched.remove_job('mining')
      print "removed running mine job in validating possible block"
    except apscheduler.jobstores.base.JobLookupError:
      print "mining job didn't exist when validating possible block"

    print "readding mine for block validating_possible_block"
    print sched
    print sched.get_jobs()
    sched.add_job(mine_for_block, kwargs={'rounds':STANDARD_ROUNDS, 'start_nonce':0}, id='mining') #add the block again
    print sched.get_jobs()

    return True
  return False
开发者ID:zhilinwww,项目名称:jbc,代码行数:24,代码来源:mine.py

示例2: Block

# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import is_valid [as 别名]
block_three_later_in_time_dir = {"nonce": "46053", "index": "3", "hash": "000000257df186344486c2c3c1ebaa159e812ca1c5c29947651672e2588efe1e", "timestamp": "1508961173", "prev_hash": "000003cf81f6b17e60ef1e3d8d24793450aecaf65cbe95086a29c1e48a5043b1", "data": "I block #3"}

block_zero = Block(block_zero_dir)
block_one = Block(block_one_dir)
block_two = Block(block_two_dir)
block_three = Block(block_three_dir)

###########################
#
#  Block time
#
###########################

another_block_zero = Block(block_zero_dir)
assert block_zero.is_valid()
assert block_zero == another_block_zero
assert not block_zero != another_block_zero

another_block_one = Block(block_one_dir)
assert block_one.is_valid()
assert block_one == another_block_one

another_block_two = Block(block_two_dir)
assert block_two.is_valid()
assert block_two == another_block_two

another_block_three = Block(block_three_dir)
assert block_three.is_valid()
assert block_three == another_block_three
开发者ID:zhilinwww,项目名称:jbc,代码行数:31,代码来源:test.py


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