forked from Qortal/qortal
Added new db query to fetch a list of all accounts that have created a non-self-share, based on confirmed transactions.
This will be used as the input dataset for the self sponsorship algo.
This commit is contained in:
parent
f50c0c87dd
commit
ab687af4bb
@ -179,6 +179,15 @@ public interface TransactionRepository {
|
|||||||
public List<TransferAssetTransactionData> getAssetTransfers(long assetId, String address, Integer limit, Integer offset, Boolean reverse)
|
public List<TransferAssetTransactionData> getAssetTransfers(long assetId, String address, Integer limit, Integer offset, Boolean reverse)
|
||||||
throws DataException;
|
throws DataException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns list of reward share transaction creators, excluding self shares.
|
||||||
|
* This uses confirmed transactions only.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws DataException
|
||||||
|
*/
|
||||||
|
public List<String> getConfirmedRewardShareCreatorsExcludingSelfShares() throws DataException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of transactions pending approval, with optional txGgroupId filtering.
|
* Returns list of transactions pending approval, with optional txGgroupId filtering.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -7,11 +7,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -969,6 +965,33 @@ public class HSQLDBTransactionRepository implements TransactionRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getConfirmedRewardShareCreatorsExcludingSelfShares() throws DataException {
|
||||||
|
List<String> rewardShareCreators = new ArrayList<>();
|
||||||
|
|
||||||
|
String sql = "SELECT account "
|
||||||
|
+ "FROM RewardShareTransactions "
|
||||||
|
+ "JOIN Accounts ON Accounts.public_key = RewardShareTransactions.minter_public_key "
|
||||||
|
+ "JOIN Transactions ON Transactions.signature = RewardShareTransactions.signature "
|
||||||
|
+ "WHERE block_height IS NOT NULL AND RewardShareTransactions.recipient != Accounts.account "
|
||||||
|
+ "GROUP BY account "
|
||||||
|
+ "ORDER BY account";
|
||||||
|
|
||||||
|
try (ResultSet resultSet = this.repository.checkedExecute(sql)) {
|
||||||
|
if (resultSet == null)
|
||||||
|
return rewardShareCreators;
|
||||||
|
|
||||||
|
do {
|
||||||
|
String address = resultSet.getString(1);
|
||||||
|
|
||||||
|
rewardShareCreators.add(address);
|
||||||
|
} while (resultSet.next());
|
||||||
|
|
||||||
|
return rewardShareCreators;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new DataException("Unable to fetch reward share creators from repository", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TransactionData> getApprovalPendingTransactions(Integer txGroupId, Integer limit, Integer offset, Boolean reverse) throws DataException {
|
public List<TransactionData> getApprovalPendingTransactions(Integer txGroupId, Integer limit, Integer offset, Boolean reverse) throws DataException {
|
||||||
StringBuilder sql = new StringBuilder(512);
|
StringBuilder sql = new StringBuilder(512);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user