示例#1
0
 def newTinfo(status):
     return account.TicketInfo(
         status=status,
         purchaseBlock=account.TinyBlock(ByteArray(0), 0),
         maturityHeight=0,
         expirationHeight=0,
     )
示例#2
0
 def newTinfo(status="live"):
     return account.TicketInfo(
         status=status,
         purchaseBlock=account.TinyBlock(ByteArray(0), 42),
         maturityHeight=0,
         expirationHeight=0,
         lotteryBlock=None,
         vote=None,
         revocation=None,
         poolFee=0,
         purchaseTxFee=1,
         spendTxFee=0,
         stakebase=0,
     )
示例#3
0
 def newTinfo(poolFee, purchaseTxFee, spendTxFee, stakebase):
     return account.TicketInfo(
         status="",
         purchaseBlock=account.TinyBlock(ByteArray(0), 0),
         maturityHeight=0,
         expirationHeight=0,
         lotteryBlock=None,
         vote=None,
         revocation=None,
         poolFee=poolFee,
         purchaseTxFee=purchaseTxFee,
         spendTxFee=spendTxFee,
         stakebase=stakebase,
     )
示例#4
0
    def test_ticketFromTx(self):
        stakeSubmission = ByteArray(opcode.OP_SSTX)
        stakeSubmission += opcode.OP_HASH160
        stakeSubmission += opcode.OP_DATA_20
        stakeSubmission += 1 << (8 * 19)
        stakeSubmission += opcode.OP_EQUAL

        tx = msgtx.MsgTx.new()
        tx.txOut = [msgtx.TxOut(pkScript=stakeSubmission, value=3)]
        ticket = account.UTXO.ticketFromTx(tx, nets.testnet)
        assert ticket.tinfo.status == "mempool"
        tinfo = account.TicketInfo("no_status", None, 0, 0)
        ticket = account.UTXO.ticketFromTx(tx, nets.testnet, None, tinfo)
        assert ticket.tinfo.status == "unconfirmed"
示例#5
0
 class BlockchainEmpty:
     ticketInfo = lambda txid: account.TicketInfo("mempool", None, 0, 0)
示例#6
0
 class BlockchainFull:
     ticketInfo = lambda txid: account.TicketInfo(
         "mempool", None, 0, 0, None, True)