mirror of
https://github.com/Qortal/qortal.git
synced 2025-07-22 20:26:50 +00:00
group approval tests and fixes
This commit is contained in:
@@ -1090,7 +1090,7 @@ public class Block {
|
||||
}
|
||||
|
||||
protected void processBlockRewards() throws DataException {
|
||||
BigDecimal reward = getRewardAtHeight(this.blockData.getHeight());
|
||||
BigDecimal reward = Block.getRewardAtHeight(this.blockData.getHeight());
|
||||
|
||||
// No reward for our height?
|
||||
if (reward == null)
|
||||
@@ -1335,7 +1335,7 @@ public class Block {
|
||||
}
|
||||
|
||||
protected void orphanBlockRewards() throws DataException {
|
||||
BigDecimal reward = getRewardAtHeight(this.blockData.getHeight());
|
||||
BigDecimal reward = Block.getRewardAtHeight(this.blockData.getHeight());
|
||||
|
||||
// No reward for our height?
|
||||
if (reward == null)
|
||||
@@ -1397,7 +1397,7 @@ public class Block {
|
||||
atRepository.deleteATStates(this.blockData.getHeight());
|
||||
}
|
||||
|
||||
protected BigDecimal getRewardAtHeight(int ourHeight) {
|
||||
public static BigDecimal getRewardAtHeight(int ourHeight) {
|
||||
List<RewardByHeight> rewardsByHeight = BlockChain.getInstance().getBlockRewardsByHeight();
|
||||
|
||||
// No rewards configured?
|
||||
|
@@ -68,9 +68,13 @@ public class GroupApprovalTransaction extends Transaction {
|
||||
if (pendingTransactionData == null)
|
||||
return ValidationResult.TRANSACTION_UNKNOWN;
|
||||
|
||||
// Check pending transaction is not already in a block
|
||||
if (this.repository.getTransactionRepository().getHeightFromSignature(groupApprovalTransactionData.getPendingSignature()) != 0)
|
||||
return ValidationResult.TRANSACTION_ALREADY_CONFIRMED;
|
||||
// Check pending transaction is actually needs group approval
|
||||
if (pendingTransactionData.getApprovalStatus() == ApprovalStatus.NOT_REQUIRED)
|
||||
return ValidationResult.GROUP_APPROVAL_NOT_REQUIRED;
|
||||
|
||||
// Check pending transaction is actually pending
|
||||
if (pendingTransactionData.getApprovalStatus() != ApprovalStatus.PENDING)
|
||||
return ValidationResult.GROUP_APPROVAL_DECIDED;
|
||||
|
||||
Account admin = getAdmin();
|
||||
|
||||
|
@@ -230,6 +230,8 @@ public abstract class Transaction {
|
||||
INVALID_PUBLIC_KEY(79),
|
||||
AT_UNKNOWN(80),
|
||||
AT_ALREADY_EXISTS(81),
|
||||
GROUP_APPROVAL_NOT_REQUIRED(82),
|
||||
GROUP_APPROVAL_DECIDED(83),
|
||||
NOT_YET_RELEASED(1000);
|
||||
|
||||
public final int value;
|
||||
|
Reference in New Issue
Block a user