コード例 #1
0
ファイル: blockstore.py プロジェクト: Whiteblock/zcash
 def get(self, blockhash):
     serialized_block = None
     try:
         serialized_block = self.blockDB[repr(blockhash)]
     except KeyError:
         return None
     f = cStringIO.StringIO(serialized_block)
     ret = CBlock()
     ret.deserialize(f)
     ret.calc_sha256()
     return ret
コード例 #2
0
ファイル: blocktools.py プロジェクト: backendmaster/zero-1
def create_block(hashprev, coinbase, nTime=None):
    block = CBlock()
    if nTime is None:
        import time
        block.nTime = int(time.time() + 600)
    else:
        block.nTime = nTime
    block.hashPrevBlock = hashprev
    block.nBits = 0x207fffff  # Will break after a difficulty adjustment...
    block.vtx.append(coinbase)
    block.hashMerkleRoot = block.calc_merkle_root()
    block.calc_sha256()
    return block
コード例 #3
0
ファイル: blocktools.py プロジェクト: Whiteblock/zcash
def create_block(hashprev, coinbase, nTime=None, nBits=None):
    block = CBlock()
    if nTime is None:
        import time
        block.nTime = int(time.time()+600)
    else:
        block.nTime = nTime
    block.hashPrevBlock = hashprev
    if nBits is None:
        block.nBits = 0x200f0f0f # Will break after a difficulty adjustment...
    else:
        block.nBits = nBits
    block.vtx.append(coinbase)
    block.hashMerkleRoot = block.calc_merkle_root()
    block.calc_sha256()
    return block
コード例 #4
0
ファイル: blockstore.py プロジェクト: mms710/zcash
 def get(self, blockhash):
     serialized_block = None
     try:
         serialized_block = self.blockDB[repr(blockhash)]
     except KeyError:
         return None
     f = cStringIO.StringIO(serialized_block)
     ret = CBlock()
     ret.deserialize(f)
     ret.calc_sha256()
     return ret
コード例 #5
0
def create_block(hashprev,
                 coinbase,
                 nTime=None,
                 nBits=None,
                 hashFinalSaplingRoot=None):
    block = CBlock()
    if nTime is None:
        import time
        block.nTime = int(time.time() + 600)
    else:
        block.nTime = nTime
    block.hashPrevBlock = hashprev
    if hashFinalSaplingRoot is not None:
        block.hashFinalSaplingRoot = hashFinalSaplingRoot
    if nBits is None:
        block.nBits = 0x200f0f0f  # Will break after a difficulty adjustment...
    else:
        block.nBits = nBits
    block.vtx.append(coinbase)
    block.hashMerkleRoot = block.calc_merkle_root()
    block.calc_sha256()
    return block