22#include <glog/logging.h>
23#include <gtest/gtest.h>
27#include "proto/utxo/rpc.pb.h"
35TEST(UTXOExecutorTest, AddUTXO) {
38 SecretKey key = KeyGenerator ::GeneratorKeys(SignatureInfo::ECDSA);
41 auto* gensis_txn = config.mutable_genesis_transactions();
42 UTXO* utxo = gensis_txn->add_transactions();
43 UTXOOut* out = utxo->add_out();
44 out->set_address(
"0001");
46 out->set_pub_key(key.public_key());
49 Transaction transaction(config, &wallet);
50 UTXOExecutor txn_manager(config, &transaction, &wallet);
54 UTXOIn* in = utxo.add_in();
58 UTXOOut* out = utxo.add_out();
59 out->set_address(
"1234");
61 utxo.set_address(
"0001");
64 key.private_key(), utxo.address() + std::to_string(0));
65 utxo.set_sig(signature);
68 *request.mutable_utxo() = utxo;
70 std::string request_str;
71 request.SerializeToString(&request_str);
73 auto ret_str = txn_manager.ExecuteData(request_str);
74 EXPECT_TRUE(ret_str !=
nullptr);
std::string ECDSASignString(const std::string &private_key, const std::string &message)
TEST(NetworkUtilsTest, GetDNSName)