Skip to content

Commit

Permalink
Format Transaction.java (and dependent code)
Browse files Browse the repository at this point in the history
Format Transaction.java (and dependent code)
  • Loading branch information
damccull committed Apr 4, 2024
1 parent f9fe720 commit 2185735
Show file tree
Hide file tree
Showing 12 changed files with 720 additions and 675 deletions.
20 changes: 10 additions & 10 deletions src/brs/BlockchainProcessorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ private void pushBlock(final Block block) throws BlockNotAcceptedException {
logger.debug(
"Block {} height {} contains transaction that was generated on a fork: {} ecBlockId {} ecBlockHeight {}",
block.getStringId(), previousLastBlock.getHeight() + 1, transaction.getStringId(),
transaction.getECBlockHeight(), Convert.toUnsignedLong(transaction.getECBlockId()));
transaction.getEcBlockHeight(), Convert.toUnsignedLong(transaction.getEcBlockId()));
}
throw new TransactionNotAcceptedException("Transaction belongs to a different fork",
transaction);
Expand Down Expand Up @@ -1108,11 +1108,11 @@ private void pushBlock(final Block block) throws BlockNotAcceptedException {
throw new TransactionNotAcceptedException(e.getMessage(), transaction);
}

calculatedTotalAmount += transaction.getAmountNQT();
calculatedTotalFee += transaction.getFeeNQT();
calculatedTotalAmount += transaction.getAmountNqt();
calculatedTotalFee += transaction.getFeeNqt();
digest.update(transaction.getBytes());
indirectIncomingService.processTransaction(transaction);
feeArray[slotIdx] = transaction.getFeeNQT();
feeArray[slotIdx] = transaction.getFeeNqt();
slotIdx += 1;
}

Expand Down Expand Up @@ -1375,7 +1375,7 @@ public void generateBlock(String secretPhrase, byte[] publicKey, Long nonce) thr
age = 1;
}

long feePriority = transaction.getFeeNQT()
long feePriority = transaction.getFeeNqt()
* (transaction.getSize() / Constants.ORDINARY_TRANSACTION_BYTES);
// So the age has less priority (60 minutes to increase the priority to the next
// level)
Expand Down Expand Up @@ -1407,7 +1407,7 @@ public void generateBlock(String secretPhrase, byte[] publicKey, Long nonce) thr
Map<Long, TreeMap<Long, Transaction>> unconfirmedTransactionsOrderedBySlotThenPriority = new HashMap<>();
inclusionCandidates.collect(Collectors.toMap(Function.identity(), priorityCalculator::applyAsLong))
.forEach((transaction, priority) -> {
long slot = (transaction.getFeeNQT() - (transaction.getFeeNQT() % FEE_QUANT_SIP3))
long slot = (transaction.getFeeNqt() - (transaction.getFeeNqt() % FEE_QUANT_SIP3))
/ FEE_QUANT_SIP3;
slot = Math.min(Signum.getFluxCapacitor().getValue(FluxValues.MAX_NUMBER_TRANSACTIONS),
slot);
Expand Down Expand Up @@ -1498,15 +1498,15 @@ public int compare(Transaction t1, Transaction t2) {
// we already got the list by priority, no need to check the fees again
slotFee = feeQuant;
}
if (transaction.getFeeNQT() >= slotFee) {
if (transaction.getFeeNqt() >= slotFee) {
if (transactionService.applyUnconfirmed(transaction)) {
try {
transactionService.validate(transaction);
payloadSize -= transaction.getSize();
totalAmountNqt += transaction.getAmountNQT();
totalFeeNqt += transaction.getFeeNQT();
totalAmountNqt += transaction.getAmountNqt();
totalFeeNqt += transaction.getFeeNqt();
if (Signum.getFluxCapacitor().getValue(FluxValues.SMART_FEES, blockHeight)) {
totalFeeCashBackNqt += transaction.getFeeNQT()
totalFeeCashBackNqt += transaction.getFeeNqt()
/ propertyService.getInt(Props.CASH_BACK_FACTOR);
}
orderedBlockTransactions.add(transaction);
Expand Down
4 changes: 2 additions & 2 deletions src/brs/DebugTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ private Map<String,String> getValues(long accountId, Trade trade, boolean isAsk)
}

private Map<String,String> getValues(long accountId, Transaction transaction, boolean isRecipient) {
long amount = transaction.getAmountNQT();
long fee = transaction.getFeeNQT();
long amount = transaction.getAmountNqt();
long fee = transaction.getFeeNqt();
if (isRecipient) {
fee = 0; // fee doesn't affect recipient account
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/brs/EconomicClustering.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ public boolean verifyFork(Transaction transaction) {
// TODO: remove this conditional above in the future, do the EC check regardless of a full hash reference
return true;
}
if (blockchain.getHeight() < Constants.EC_CHANGE_BLOCK_1 && blockchain.getHeight() - transaction.getECBlockHeight() > Constants.EC_BLOCK_DISTANCE_LIMIT) {
if (blockchain.getHeight() < Constants.EC_CHANGE_BLOCK_1 && blockchain.getHeight() - transaction.getEcBlockHeight() > Constants.EC_BLOCK_DISTANCE_LIMIT) {
return false;
}
Block ecBlock = blockchain.getBlock(transaction.getECBlockId());
return ecBlock != null && ecBlock.getHeight() == transaction.getECBlockHeight();
Block ecBlock = blockchain.getBlock(transaction.getEcBlockId());
return ecBlock != null && ecBlock.getHeight() == transaction.getEcBlockHeight();
}
catch ( NullPointerException e ) {
if (logger.isDebugEnabled()) {
Expand Down
Loading

0 comments on commit 2185735

Please sign in to comment.