Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cpp/daemon/py_monero_daemon_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ void PyMoneroConnectionManager::add_listener(const std::shared_ptr<monero_connec

void PyMoneroConnectionManager::remove_listener(const std::shared_ptr<monero_connection_manager_listener> &listener) {
boost::lock_guard<boost::recursive_mutex> lock(m_listeners_mutex);
std::remove_if(m_listeners.begin(), m_listeners.end(), [&listener](std::shared_ptr<monero_connection_manager_listener> iter){ return iter == listener; }), m_listeners.end();
m_listeners.erase(std::remove_if(m_listeners.begin(), m_listeners.end(), [&listener](std::shared_ptr<monero_connection_manager_listener> iter){ return iter == listener; }), m_listeners.end());
}

void PyMoneroConnectionManager::remove_listeners() {
Expand Down
5 changes: 2 additions & 3 deletions src/cpp/wallet/py_monero_wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,6 @@ void PyMoneroWalletRpc::rescan_blockchain() {
uint64_t PyMoneroWalletRpc::get_balance() const {
auto wallet_balance = get_balances(boost::none, boost::none);
return wallet_balance->m_balance;
return 0;
}

uint64_t PyMoneroWalletRpc::get_balance(uint32_t account_index) const {
Expand Down Expand Up @@ -745,11 +744,11 @@ std::vector<monero_account> PyMoneroWalletRpc::get_accounts(bool include_subaddr
auto node = response->m_result.get();
std::vector<monero_account> accounts;
PyMoneroAccount::from_property_tree(node, accounts);
std::vector<uint32_t> empty_indices;

if (include_subaddresses) {

for (auto &account : accounts) {
std::vector<uint32_t> empty_indices;
account.m_subaddresses = get_subaddresses(account.m_index.get(), empty_indices, true);

if (!skip_balances) {
Expand Down Expand Up @@ -1472,7 +1471,7 @@ std::shared_ptr<monero_tx_config> PyMoneroWalletRpc::parse_payment_uri(const std
void PyMoneroWalletRpc::set_attribute(const std::string& key, const std::string& val) {
auto params = std::make_shared<PyMoneroWalletAttributeParams>(key, val);
PyMoneroJsonRequest request("set_attribute", params);
std::shared_ptr<PyMoneroJsonResponse> response = m_rpc->send_json_request(request);
m_rpc->send_json_request(request);
}

bool PyMoneroWalletRpc::get_attribute(const std::string& key, std::string& value) const {
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/wallet/py_monero_wallet_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void PyMoneroTxWallet::from_property_tree_with_transfer(const boost::property_tr
if (outgoing_transfer == nullptr) outgoing_transfer = std::make_shared<monero::monero_outgoing_transfer>();
incoming_transfer->m_amount = it->second.get_value<uint64_t>();
}
else if (!is_outgoing) {
else {
if (incoming_transfer == nullptr) incoming_transfer = std::make_shared<monero::monero_incoming_transfer>();
incoming_transfer->m_tx = tx;
incoming_transfer->m_amount = it->second.get_value<uint64_t>();
Expand Down
6 changes: 3 additions & 3 deletions tests/test_monero_daemon_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def test_get_txs_by_hashes(self) -> None:
# fetch tx hashses to test
tx_hashes = Utils.get_confirmed_tx_hashes(self._daemon)
assert len(tx_hashes) > 0, "No tx hashes found"

# context for creating txs
ctx = TestContext()
ctx.is_pruned = False
Expand Down Expand Up @@ -375,8 +375,8 @@ def test_get_tx_pool_statistics(self):
# Can get the miner tx sum
@pytest.mark.skipif(Utils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled")
def test_get_miner_tx_sum(self) -> None:
sum = self._daemon.get_miner_tx_sum(0, min(5000, self._daemon.get_height()))
Utils.test_miner_tx_sum(sum)
tx_sum = self._daemon.get_miner_tx_sum(0, min(5000, self._daemon.get_height()))
Utils.test_miner_tx_sum(tx_sum)

# Can get fee estimate
@pytest.mark.skipif(Utils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_monero_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_serialize_text_short(self, config: TestMoneroUtils.Config):
binary: bytes = MoneroUtils.dict_to_binary(json_map)
MoneroTestUtils.assert_true(len(binary) > 0)
json_map2: dict[Any, Any] = MoneroUtils.binary_to_dict(binary)

assert json_map == json_map2

# Can serialize json with long text
Expand Down
13 changes: 7 additions & 6 deletions tests/test_monero_wallet_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def parse(cls, parser: ConfigParser) -> BaseTestMoneroWallet.Config:
config.seed = parser.get(section, "seed")
return config

# region Private Methods
#region Private Methods

@classmethod
def _get_test_daemon(cls) -> MoneroDaemonRpc:
Expand Down Expand Up @@ -67,19 +67,20 @@ def get_test_wallet(self) -> MoneroWallet:
def is_random_wallet_config(cls, config: MoneroWalletConfig) -> bool:
return config.seed is None and config.primary_address is None

# endregion
#endregion

#region Fixtures

@pytest.fixture(scope="class")
def config(self) -> BaseTestMoneroWallet.Config:
def test_config(self) -> BaseTestMoneroWallet.Config:
parser = ConfigParser()
parser.read('config/test_monero_wallet_common.ini')
parser.read('tests/config/test_monero_wallet_common.ini')
return BaseTestMoneroWallet.Config.parse(parser)

#endregion

# region Tests
#region Tests

@pytest.mark.skipif(TestUtils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled")
def test_create_wallet_random(self) -> None:
"""
Expand Down Expand Up @@ -981,4 +982,4 @@ def test_mining(self):
wallet.start_mining(2, False, True)
wallet.stop_mining()

# endregion
#endregion
Loading