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
7 changes: 5 additions & 2 deletions src/cpp/wallet/py_monero_wallet_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ void PyMoneroTxWallet::from_property_tree_with_output(const boost::property_tree
tx->m_is_confirmed = true;
tx->m_is_relayed = true;
tx->m_is_failed = false;
tx->m_in_tx_pool = false;

auto output = std::make_shared<monero::monero_output_wallet>();
auto key_image = std::make_shared<monero::monero_key_image>();
Expand Down Expand Up @@ -1743,13 +1744,15 @@ rapidjson::Value PyMoneroGetTransfersParams::to_rapidjson_val(rapidjson::Documen
rapidjson::Value root(rapidjson::kObjectType);
rapidjson::Value value_num(rapidjson::kNumberType);
rapidjson::Value value_str(rapidjson::kStringType);
bool filter_by_height = m_min_height != boost::none || m_max_height != boost::none;
monero_utils::add_json_member("filter_by_height", filter_by_height, allocator, root);
if (m_in != boost::none) monero_utils::add_json_member("in", m_in.get(), allocator, root);
if (m_out != boost::none) monero_utils::add_json_member("out", m_out.get(), allocator, root);
if (m_pool != boost::none) monero_utils::add_json_member("pool", m_pool.get(), allocator, root);
if (m_pending != boost::none) monero_utils::add_json_member("pending", m_pending.get(), allocator, root);
if (m_failed != boost::none) monero_utils::add_json_member("failed", m_failed.get(), allocator, root);
if (m_min_height != boost::none) monero_utils::add_json_member("min_height", m_min_height.get(), allocator, root);
if (m_max_height != boost::none) monero_utils::add_json_member("max_height", m_max_height.get(), allocator, root);
if (m_min_height != boost::none) monero_utils::add_json_member("min_height", m_min_height.get(), allocator, root, value_num);
if (m_max_height != boost::none) monero_utils::add_json_member("max_height", m_max_height.get(), allocator, root, value_num);
if (m_all_accounts != boost::none) monero_utils::add_json_member("all_accounts", m_all_accounts.get(), allocator, root);
if (m_account_index != boost::none) monero_utils::add_json_member("account_index", m_account_index.get(), allocator, root, value_num);
if (!m_subaddr_indices.empty()) root.AddMember("subaddr_indices", monero_utils::to_rapidjson_val(allocator, m_subaddr_indices), allocator);
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/wallet/py_monero_wallet_rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ std::string PyMoneroWalletRpc::get_address(const uint32_t account_idx, const uin
auto it3 = m_address_cache.find(account_idx);
if (it3 == m_address_cache.end()) throw std::runtime_error("Could not find account address at index (" + std::to_string(account_idx) + ", " + std::to_string(subaddress_idx) + ")" );
auto it4 = it3->second.find(subaddress_idx);
if (it4 == it3->second.end()) throw std::runtime_error("Could not find address at index (" + std::to_string(account_idx) + ", " + std::to_string(subaddress_idx) + ")" );
if (it4 == it3->second.end()) return std::string("");
return it4->second;
}

Expand Down
6 changes: 4 additions & 2 deletions src/python/monero_output_query.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ class MoneroOutputQuery(MoneroOutputWallet):
"""Filter outputs below this amount."""
subaddress_indices: list[int]
"""Subadress indices to select (empty for all)."""
tx_query: MoneroTxQuery | None
"""Related transaction query."""
@property
def tx_query(self) -> MoneroTxQuery | None:
"""Related transaction query."""
...
@staticmethod
def deserialize_from_block(output_query_json: str) -> MoneroOutputQuery:
...
Expand Down
1 change: 1 addition & 0 deletions tests/config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ test_relays=True
test_non_relays=True
lite_mode=False
test_notifications=True
test_resets=True
network_type=regtest
auto_connect_timeout_ms=3000

Expand Down
12 changes: 4 additions & 8 deletions tests/test_monero_daemon_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
BinaryBlockContext,
AssertUtils, TxUtils,
BlockUtils, GenUtils,
DaemonUtils, BlockchainUtils,
MiningUtils
DaemonUtils, WalletType,
IntegrationTestUtils
)

logger: logging.Logger = logging.getLogger("TestMoneroDaemonRpc")
Expand All @@ -32,11 +32,7 @@ class TestMoneroDaemonRpc:

@pytest.fixture(scope="class", autouse=True)
def before_all(self):
BlockchainUtils.setup_blockchain(Utils.NETWORK_TYPE)
wallet = Utils.get_wallet_rpc()
tx = MiningUtils.fund_wallet(wallet, 1)
if tx is not None:
BlockchainUtils.wait_for_blocks(11)
IntegrationTestUtils.setup(WalletType.RPC)

@pytest.fixture(autouse=True)
def setup_and_teardown(self, request: pytest.FixtureRequest):
Expand Down Expand Up @@ -377,14 +373,14 @@ def test_get_txs_by_hashes(self, daemon: MoneroDaemonRpc, wallet: MoneroWalletRp
# Can get transaction pool statistics
@pytest.mark.skipif(Utils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled")
def test_get_tx_pool_statistics(self, daemon: MoneroDaemonRpc, wallet: MoneroWalletRpc) -> None:
wallet = wallet
Utils.WALLET_TX_TRACKER.wait_for_txs_to_clear_pool([wallet])
tx_ids: list[str] = []
try:
# submit txs to the pool but don't relay
i = 1
while i < 3:
# submit tx hex
logger.debug(f"test_get_tx_pool_statistics: account {i}")
tx: MoneroTx = TxUtils.get_unrelayed_tx(wallet, i)
assert tx.full_hex is not None
result: MoneroSubmitTxResult = daemon.submit_tx_hex(tx.full_hex, True)
Expand Down
Loading