TEST(parse_and_validate_tx_extra, fails_on_big_extra_nonce) { Logging::LoggerGroup logger; CryptoNote::Currency currency = CryptoNote::CurrencyBuilder(logger).currency(); CryptoNote::Transaction tx = AUTO_VAL_INIT(tx); CryptoNote::account_base acc; acc.generate(); CryptoNote::blobdata b(TX_EXTRA_NONCE_MAX_COUNT + 1, 0); ASSERT_FALSE(currency.constructMinerTx(0, 0, 10000000000000, 1000, currency.minimumFee(), acc.get_keys().m_account_address, tx, b, 1)); }
TEST(parse_and_validate_tx_extra, is_valid_tx_extra_parsed) { Logging::LoggerGroup logger; CryptoNote::Currency currency = CryptoNote::CurrencyBuilder(logger).currency(); CryptoNote::Transaction tx = AUTO_VAL_INIT(tx); CryptoNote::account_base acc; acc.generate(); CryptoNote::blobdata b = "dsdsdfsdfsf"; ASSERT_TRUE(currency.constructMinerTx(0, 0, 10000000000000, 1000, currency.minimumFee(), acc.get_keys().m_account_address, tx, b, 1)); crypto::public_key tx_pub_key = CryptoNote::get_tx_pub_key_from_extra(tx); ASSERT_NE(tx_pub_key, CryptoNote::null_pkey); }
std::error_code TestWallet::init() { CryptoNote::account_base walletAccount; walletAccount.generate(); WalletAccountKeys walletKeys; walletKeys.spendPublicKey = reinterpret_cast<const WalletPublicKey&>(walletAccount.get_keys().m_account_address.m_spendPublicKey); walletKeys.spendSecretKey = reinterpret_cast<const WalletSecretKey&>(walletAccount.get_keys().m_spend_secret_key); walletKeys.viewPublicKey = reinterpret_cast<const WalletPublicKey&>(walletAccount.get_keys().m_account_address.m_viewPublicKey); walletKeys.viewSecretKey = reinterpret_cast<const WalletSecretKey&>(walletAccount.get_keys().m_view_secret_key); m_wallet->initWithKeys(walletKeys, TEST_PASSWORD); m_synchronizationCompleted.wait(); return m_lastSynchronizationResult; }