Skip to content

Commit 54b560b

Browse files
fix: Fix the transactionFee in the record for ConsensusSubmitMessage with custom fees (#19195)
Signed-off-by: Neeharika-Sompalli <[email protected]>
1 parent 485a081 commit 54b560b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/workflows/DispatchOptions.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public static <T extends StreamBuilder> DispatchOptions<T> stepDispatch(
334334
ReversingBehavior.REMOVABLE,
335335
transactionCustomizer,
336336
metaData,
337-
null);
337+
NOOP_FEE_CHARGING);
338338
}
339339

340340
/**

hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip991/TopicCustomFeeSubmitMessageTest.java

+11
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.NO_VALID_MAX_CUSTOM_FEE;
5454
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.SUCCESS;
5555
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_NOT_ASSOCIATED_TO_ACCOUNT;
56+
import static org.junit.jupiter.api.Assertions.assertEquals;
5657
import static org.junit.jupiter.api.Assertions.assertTrue;
5758

5859
import com.hedera.services.bdd.junit.HapiTest;
@@ -67,6 +68,7 @@
6768
import com.hederahashgraph.api.proto.java.ResponseCodeEnum;
6869
import com.hederahashgraph.api.proto.java.TokenID;
6970
import com.hederahashgraph.api.proto.java.TokenType;
71+
import com.hederahashgraph.api.proto.java.TransactionRecord;
7072
import edu.umd.cs.findbugs.annotations.NonNull;
7173
import java.util.stream.Stream;
7274
import org.junit.jupiter.api.BeforeAll;
@@ -1834,6 +1836,7 @@ final Stream<DynamicTest> submitToTopicWith3layersFee() {
18341836
.hasNonStakingChildRecordCount(0)
18351837
.logged();
18361838
allRunFor(spec, submitTxnRecord);
1839+
validateTransactionFees(submitTxnRecord.getResponseRecord());
18371840
}),
18381841
// assert topic fee collector balance
18391842
getAccountBalance(collector).hasTokenBalance(tokenName, 1),
@@ -1843,6 +1846,14 @@ final Stream<DynamicTest> submitToTopicWith3layersFee() {
18431846
.hasTinyBars(ONE_HBAR)));
18441847
}
18451848

1849+
private void validateTransactionFees(final TransactionRecord record) {
1850+
final var feeCreditSum = record.getTransferList().getAccountAmountsList().stream()
1851+
.filter(aa -> aa.getAccountID().getAccountNum() < 1000)
1852+
.mapToInt(aa -> (int) aa.getAmount())
1853+
.sum();
1854+
assertEquals(record.getTransactionFee(), feeCreditSum);
1855+
}
1856+
18461857
@HapiTest
18471858
@DisplayName("Submit ot topic with multiple 3 layers fee should have 0 child records")
18481859
final Stream<DynamicTest> submitToTopicWithMultiple3layersFee() {

0 commit comments

Comments
 (0)