diff --git a/src/ripple/app/rdb/impl/Wallet.cpp b/src/ripple/app/rdb/impl/Wallet.cpp index c6040964b..24715404c 100644 --- a/src/ripple/app/rdb/impl/Wallet.cpp +++ b/src/ripple/app/rdb/impl/Wallet.cpp @@ -254,7 +254,10 @@ readAmendments( soci::transaction tr(session); std::string sql = - "SELECT AmendmentHash, AmendmentName, Veto FROM FeatureVotes"; + "SELECT AmendmentHash, AmendmentName, Veto FROM " + "( SELECT AmendmentHash, AmendmentName, Veto, RANK() OVER " + "( PARTITION BY AmendmentHash ORDER BY ROWID DESC ) " + "as rnk FROM FeatureVotes ) WHERE rnk = 1"; // SOCI requires boost::optional (not std::optional) as parameters. boost::optional amendment_hash; boost::optional amendment_name;