TEST_F(InProcessNode, initOk) { CryptoNote::InProcessNode newNode(coreStub, protocolQueryStub); CallbackStatus status; newNode.init([&status] (std::error_code ec) { status.setStatus(ec); }); ASSERT_TRUE(status.ok()); }
TEST_F(InProcessNode, getTransactionOutsGlobalIndicesSuccess) { crypto::hash ignore; std::vector<uint64_t> indices; std::vector<uint64_t> expectedIndices; uint64_t start = 10; std::generate_n(std::back_inserter(expectedIndices), 5, [&start] () { return start++; }); coreStub.set_outputs_gindexs(expectedIndices, true); CallbackStatus status; node.getTransactionOutsGlobalIndices(ignore, indices, [&status] (std::error_code ec) { status.setStatus(ec); }); ASSERT_TRUE(status.ok()); ASSERT_EQ(expectedIndices.size(), indices.size()); std::sort(indices.begin(), indices.end()); ASSERT_TRUE(std::equal(indices.begin(), indices.end(), expectedIndices.begin())); }
TEST_F(InProcessNode, getRandomOutsByAmountsSuccess) { crypto::public_key ignoredPublicKey; crypto::secret_key ignoredSectetKey; crypto::generate_keys(ignoredPublicKey, ignoredSectetKey); cryptonote::COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS_response expectedResp; cryptonote::COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS_outs_for_amount out; out.amount = 10; out.outs.push_back({ 11, ignoredPublicKey }); expectedResp.outs.push_back(out); coreStub.set_random_outs(expectedResp, true); std::vector<cryptonote::COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS_outs_for_amount> outs; CallbackStatus status; node.getRandomOutsByAmounts({1,2,3}, 1, outs, [&status] (std::error_code ec) { status.setStatus(ec); }); ASSERT_TRUE(status.ok()); ASSERT_EQ(1, outs.size()); ASSERT_EQ(10, outs[0].amount); ASSERT_EQ(1, outs[0].outs.size()); ASSERT_EQ(11, outs[0].outs.front().global_amount_index); }
void InProcessNode::initNode() { CallbackStatus status; node.init([&status] (std::error_code ec) { status.setStatus(ec); }); ASSERT_TRUE(status.ok()); }