Exemple #1
0
def mint_tx(gap):
    txs = tools.local_get('txs')
    height = tools.local_get('height')
    on_block = int(tools.local_get('length')) + 1
    return {
        'type': 'mint',
        'fee': tools.mint_cost(txs, gap),
        'on_block': on_block,
        'height': height + gap
    }
Exemple #2
0
def mint_verify(tx, txs, out, DB):
    length = tools.local_get('length')
    height = tools.local_get('height')
    custom.block_fee(tx['height'] - height)
    gap = tx['height'] - height
    for t in txs:
        if t['type'] == 'mint':
            out[0] += 'no mint repeats'
    if tx['on_block'] != length + 1:
        out[0] += 'on wrong block'
        return False
    if len(filter(lambda x: x['type'] == 'mint', txs)) > 0:
        out[0] += 'too many mints'
        return False
    amount = tools.mint_cost(txs, gap)
    if tx['fee'] != amount:
        tools.log('have: ' + str(tx['amount']))
        tools.log('need: ' + str(amount))
        tools.log('that amount is too big')
        return False
    return True
Exemple #3
0
def mint_verify(tx, txs, out, DB):
    length = tools.local_get("length")
    height = tools.local_get("height")
    custom.block_fee(tx["height"] - height)
    gap = tx["height"] - height
    for t in txs:
        if t["type"] == "mint":
            out[0] += "no mint repeats"
    if tx["on_block"] != length + 1:
        out[0] += "on wrong block"
        return False
    if len(filter(lambda x: x["type"] == "mint", txs)) > 0:
        out[0] += "too many mints"
        return False
    amount = tools.mint_cost(txs, gap)
    if tx["fee"] != amount:
        tools.log("have: " + str(tx["amount"]))
        tools.log("need: " + str(amount))
        tools.log("that amount is too big")
        return False
    return True
Exemple #4
0
def mint_verify(tx, txs, out, DB):
    length=tools.local_get('length')
    height=tools.local_get('height')
    custom.block_fee(tx['height']-height)
    gap=tx['height']-height
    for t in txs:
        if t['type']=='mint': 
            out[0]+='no mint repeats'
    if not tools.fee_check(tx, txs, DB):
        out[0]+='fee check error'
        return False
    if tx['on_block']!=length+1:
        out[0]+='on wrong block'
        return False
    if len(filter(lambda x: x['type']=='mint', txs))>0:
        out[0]+='too many mints'
        return False
    amount=tools.mint_cost(txs, gap)
    if tx['amount']!=amount:
        tools.log('have: ' +str(tx['amount']))
        tools.log('need: ' +str(amount))
        tools.log('that amount is too big')
        return False
    return True
Exemple #5
0
def mint_tx(gap):
    txs=tools.local_get('txs')
    height=tools.local_get('height')
    on_block=int(tools.local_get('length'))+1
    return {'type':'mint', 'amount':tools.mint_cost(txs, gap), 'on_block':on_block, 'height':height+gap}
Exemple #6
0
def mint_tx(gap):
    txs = tools.local_get("txs")
    height = tools.local_get("height")
    on_block = int(tools.local_get("length")) + 1
    return {"type": "mint", "fee": tools.mint_cost(txs, gap), "on_block": on_block, "height": height + gap}