def test_derive_hash(): address = 'CHPJ6aVwpGBRf1dv6Ey1TuhJzt1VtCP5LYB' nonce = 32 tx_action_number = 2 expected = '5kHcMrwXUptjmbdR8XBW2yY3FkSFwnMdrVr22Yg39pTR' actual = crypto.derive_hash(address, nonce, tx_action_number) assert expected == actual
def test_create_account_action_returns_account_hash(): sender_wallet = crypto.Wallet() nonce = 1 expected = crypto.derive_hash(sender_wallet.address, nonce, 1) tx = transactions.Tx(sender_wallet.address, nonce, 0.01, 0) actual = tx.add_create_account_action() assert expected == actual
def add_create_account_action(self): self.add_action('CreateAccount', {}) return crypto.derive_hash(self.sender_address, self.nonce, len(self.actions))