예제 #1
0
def testIsValidTransactionChainBadHistoricBalance(Blockchain3Blocks):
    wallet = Wallet()
    badTransaction = Trasaction(wallet, 'recipient', 1)
    badTransaction.output[wallet.address] = 9000
    badTransaction.input['amount'] = 9001
    badTransaction.input['signature'] = wallet.sign(badTransaction.output)

    Blockchain3Blocks.addBlock([badTransaction.to_json()])

    with pytest.raises(Exception, match='has an invalid input amount'):
        Blockchain.isValidTransactionChain(Blockchain3Blocks.chain)
예제 #2
0
def testVerifyValidSing():
    data = {'foo': 'testData'}
    wallet = Wallet()
    signature = wallet.sign(data)

    assert Wallet.verify(wallet.public_key, data, signature)