Align wallet name config with develop changes

This commit is contained in:
hirunda 2022-09-27 20:56:13 +02:00
parent 52b40fd6c0
commit 3fa3ff200b
3 changed files with 16 additions and 27 deletions

View file

@ -65,19 +65,14 @@ public:
virtual uint64_t estimatesmartfee(uint16_t conf_target = 128) = 0;
virtual std::vector<info_for_vin> getblock(const block_data &block, int32_t verbosity = 2) = 0;
virtual btc_tx getrawtransaction(const std::string &txid, const bool verbose = false) = 0;
virtual void getnetworkinfo() = 0;
virtual void getnetworkinfo() {;};
virtual std::string getblockchaininfo() = 0;
virtual std::vector<btc_txout> listunspent_by_address_and_amount(const std::string &address, double transfer_amount, const uint32_t minconf = 1, const uint32_t maxconf = 9999999) = 0;
virtual std::string sendrawtransaction(const std::string &tx_hex) = 0;
virtual std::string loadwallet(const std::string &filename) {
return "";
};
virtual std::string walletlock() {
return "";
};
virtual bool walletpassphrase(const std::string &passphrase, uint32_t timeout = 60) {
return false;
};
virtual void importmulti(const std::vector<multi_params> &address_or_script_array, const bool rescan = true){;};
virtual std::string loadwallet(const std::string &filename) { return ""; };
virtual std::string walletlock() { return ""; };
virtual bool walletpassphrase(const std::string &passphrase, uint32_t timeout = 60) { return false; };
};
class bitcoin_rpc_client : public bitcoin_client_base, public rpc_client {
@ -113,7 +108,6 @@ public:
uint64_t estimatesmartfee(uint16_t conf_target = 128);
std::vector<info_for_vin> getblock(const block_data &block, int32_t verbosity = 2);
btc_tx getrawtransaction(const std::string &txid, const bool verbose = false);
void getnetworkinfo();
std::string getblockchaininfo();
std::vector<btc_txout> listunspent_by_address_and_amount(const std::string &address, double transfer_amount, const uint32_t minconf = 1, const uint32_t maxconf = 9999999);
std::string sendrawtransaction(const std::string &tx_hex);
@ -194,7 +188,7 @@ private:
uint32_t rpc_port;
std::string rpc_user;
std::string rpc_password;
std::string wallet;
std::string wallet_name;
std::string wallet_password;
std::unique_ptr<bitcoin_client_base> bitcoin_client;

View file

@ -176,7 +176,7 @@ void peerplays_sidechain_plugin_impl::plugin_set_program_options(
cli.add_options()("libbitcoin-server-ip", bpo::value<string>()->default_value("127.0.0.1"), "Libbitcoin server IP address");
cli.add_options()("libbitcoin-server-zmq-port", bpo::value<uint32_t>()->default_value(9093), "ZMQ port of libbitcoin server");
cli.add_options()("bitcoin-wallet", bpo::value<string>(), "Bitcoin wallet");
cli.add_options()("bitcoin-wallet-name", bpo::value<string>(), "Bitcoin wallet");
cli.add_options()("bitcoin-wallet-password", bpo::value<string>(), "Bitcoin wallet password");
cli.add_options()("bitcoin-private-key", bpo::value<vector<string>>()->composing()->multitoken()->DEFAULT_VALUE_VECTOR(std::make_pair("02d0f137e717fb3aab7aff99904001d49a0a636c5e1342f8927a4ba2eaee8e9772", "cVN31uC9sTEr392DLVUEjrtMgLA8Yb3fpYmTRj7bomTm6nn2ANPr")),
"Tuple of [Bitcoin public key, Bitcoin private key] (may specify multiple times)");

View file

@ -428,12 +428,6 @@ btc_tx bitcoin_libbitcoin_client::getrawtransaction(const std::string &txid, con
return tx;
}
void bitcoin_libbitcoin_client::getnetworkinfo() {
// This function is only used for bitcoind client in order of getting
// version of bitcoin client. Version is used for extracting addresses or address
// which is not important for libbitcoin client
}
std::string bitcoin_libbitcoin_client::getblockchaininfo() {
if (get_is_test_net()) {
is_test_net = true;
@ -604,9 +598,10 @@ sidechain_net_handler_bitcoin::sidechain_net_handler_bitcoin(peerplays_sidechain
rpc_port = options.at("bitcoin-node-rpc-port").as<uint32_t>();
rpc_user = options.at("bitcoin-node-rpc-user").as<std::string>();
rpc_password = options.at("bitcoin-node-rpc-password").as<std::string>();
std::string wallet = "";
if (options.count("bitcoin-wallet")) {
wallet = options.at("bitcoin-wallet").as<std::string>();
wallet_name = "";
if (options.count("bitcoin-wallet-name")) {
wallet_name = options.at("bitcoin-wallet-name").as<std::string>();
}
wallet_password = "";
if (options.count("bitcoin-wallet-password")) {
@ -627,12 +622,12 @@ sidechain_net_handler_bitcoin::sidechain_net_handler_bitcoin(peerplays_sidechain
if (use_bitcoind_client) {
std::string url = bitcoin_node_ip + ":" + std::to_string(rpc_port);
if (wallet.length() > 0) {
url = url + "/wallet/" + wallet;
if (wallet_name.length() > 0) {
url = url + "/wallet/" + wallet_name;
}
bitcoin_client = std::unique_ptr<bitcoin_rpc_client>(new bitcoin_rpc_client(url, rpc_user, rpc_password, debug_rpc_calls));
if (!wallet.empty()) {
bitcoin_client->loadwallet(wallet);
if (!wallet_name.empty()) {
bitcoin_client->loadwallet(wallet_name);
}
listener = std::unique_ptr<zmq_listener>(new zmq_listener(bitcoin_node_ip, bitcoin_node_zmq_port));
@ -1632,7 +1627,7 @@ void sidechain_net_handler_bitcoin::on_changed_objects_cb(const vector<object_id
}
//! importmulti
// bitcoin_client->importmulti(address_or_script_array);
bitcoin_client->importmulti(address_or_script_array);
//! Lock wallet
bitcoin_client->walletlock();