fix(tx): list transactions with account "*" so labelled rows show
listtransactions was called with the default "" account, which returns only rows in the unnamed account. Transactions tied to a labelled address were left out of the History tab entirely. - All three listtransactions call sites now pass "*", which spans every account, so labelled-address rows appear alongside the rest. - With "*" the daemon also emits "move" accounting rows that have no txid, address or vout. Those are not wallet transactions, so they are skipped and never become blank History rows. No real transaction row is dropped by this filter. Tests cover that a "move" row is skipped while a labelled receive row is kept, and that the transparent collectors now page with "*". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+18
-4
@@ -1684,6 +1684,20 @@ void testNetworkRefreshSnapshotHelpers()
|
||||
EXPECT_EQ(transactions[0].timestamp, static_cast<int64_t>(100));
|
||||
EXPECT_EQ(transactions[1].timestamp, static_cast<int64_t>(300));
|
||||
|
||||
{
|
||||
// C266: "move" accounting rows (no txid) are skipped; labelled-address receive rows are kept.
|
||||
std::vector<dragonx::TransactionInfo> moveTx;
|
||||
std::set<std::string> moveKnown;
|
||||
Refresh::appendTransparentTransactions(moveTx, moveKnown, json::array({
|
||||
json{{"category", "move"}, {"account", "x"}, {"amount", 0.5}, {"time", 50}},
|
||||
json{{"txid", "labelled-recv"}, {"category", "receive"}, {"account", "savings"},
|
||||
{"amount", 2.0}, {"time", 60}, {"confirmations", 3}, {"address", "R-labelled"}}
|
||||
}));
|
||||
EXPECT_EQ(moveTx.size(), static_cast<size_t>(1));
|
||||
EXPECT_EQ(moveTx[0].txid, std::string("labelled-recv"));
|
||||
EXPECT_EQ(moveKnown.count(""), static_cast<size_t>(0));
|
||||
}
|
||||
|
||||
Refresh::appendShieldedReceivedTransactions(transactions, knownTxids, "zs-viewonly", json::array({
|
||||
json{{"txid", "transparent-a"}, {"amount", 9.0}, {"confirmations", 1}},
|
||||
json{{"txid", "shielded-change"}, {"change", true}, {"amount", 2.0}},
|
||||
@@ -2411,8 +2425,8 @@ void testNetworkRefreshRpcCollectors()
|
||||
}));
|
||||
auto pagedResult = Refresh::collectTransactionRefreshResult(pagedRpc, pagedSnapshot, 327, 0);
|
||||
EXPECT_TRUE(pagedRpc.methodNames() == std::vector<std::string>({"listtransactions", "listtransactions"}));
|
||||
EXPECT_EQ(pagedRpc.calls[0].params, json::array({"", 1000, 0}));
|
||||
EXPECT_EQ(pagedRpc.calls[1].params, json::array({"", 1000, 1000}));
|
||||
EXPECT_EQ(pagedRpc.calls[0].params, json::array({"*", 1000, 0}));
|
||||
EXPECT_EQ(pagedRpc.calls[1].params, json::array({"*", 1000, 1000}));
|
||||
EXPECT_EQ(pagedResult.transactions.size(), static_cast<size_t>(1001));
|
||||
EXPECT_EQ(pagedResult.transactions[0].txid, std::string("paged-1000"));
|
||||
|
||||
@@ -2469,7 +2483,7 @@ void testNetworkRefreshRpcCollectors()
|
||||
}));
|
||||
auto recent = Refresh::collectRecentTransactionRefreshResult(recentRpc, recentSnapshot, 123);
|
||||
EXPECT_TRUE(recentRpc.methodNames() == std::vector<std::string>({"listtransactions"}));
|
||||
EXPECT_EQ(recentRpc.calls[0].params, json::array({"", 100, 0}));
|
||||
EXPECT_EQ(recentRpc.calls[0].params, json::array({"*", 100, 0}));
|
||||
EXPECT_EQ(recent.blockHeight, 123);
|
||||
EXPECT_EQ(recent.transactions.size(), static_cast<size_t>(3));
|
||||
EXPECT_EQ(recent.transactions[0].txid, std::string("recent-two"));
|
||||
@@ -16194,7 +16208,7 @@ void testHistoryCollectorSweepAndEnrichment()
|
||||
MockRefreshRpc rpc;
|
||||
rpc.addResponse("listtransactions", json::array());
|
||||
auto result = Refresh::collectTransactionRefreshResult(rpc, snap, 110, 4);
|
||||
EXPECT_EQ(rpc.calls[0].params, json::array({"", 1700, 0}));
|
||||
EXPECT_EQ(rpc.calls[0].params, json::array({"*", 1700, 0}));
|
||||
EXPECT_TRUE(result.transparentChainOk);
|
||||
}
|
||||
{ // Same tip, nothing changed: the transparent rows are reused, no listtransactions at all; a tracked
|
||||
|
||||
Reference in New Issue
Block a user