Skip to content

Commit 1228c40

Browse files
fix: Fix the transactionFee in the record for ConsensusSubmitMessage with custom fees (#19201)
Signed-off-by: Neeharika-Sompalli <[email protected]>
1 parent 5ce3583 commit 1228c40

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
@@ -335,7 +335,7 @@ public static <T extends StreamBuilder> DispatchOptions<T> stepDispatch(
335335
ReversingBehavior.REMOVABLE,
336336
transactionCustomizer,
337337
metaData,
338-
null);
338+
NOOP_FEE_CHARGING);
339339
}
340340

341341
/**

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

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

5960
import com.hedera.services.bdd.junit.HapiTest;
@@ -68,6 +69,7 @@
6869
import com.hederahashgraph.api.proto.java.ResponseCodeEnum;
6970
import com.hederahashgraph.api.proto.java.TokenID;
7071
import com.hederahashgraph.api.proto.java.TokenType;
72+
import com.hederahashgraph.api.proto.java.TransactionRecord;
7173
import edu.umd.cs.findbugs.annotations.NonNull;
7274
import java.util.Arrays;
7375
import java.util.stream.Stream;
@@ -1885,6 +1887,7 @@ final Stream<DynamicTest> submitToTopicWith3layersFee() {
18851887
.hasNonStakingChildRecordCount(0)
18861888
.logged();
18871889
allRunFor(spec, submitTxnRecord);
1890+
validateTransactionFees(submitTxnRecord.getResponseRecord());
18881891
}),
18891892
// assert topic fee collector balance
18901893
getAccountBalance(collector).hasTokenBalance(tokenName, 1),
@@ -1894,6 +1897,14 @@ final Stream<DynamicTest> submitToTopicWith3layersFee() {
18941897
.hasTinyBars(ONE_HBAR)));
18951898
}
18961899

1900+
private void validateTransactionFees(final TransactionRecord record) {
1901+
final var feeCreditSum = record.getTransferList().getAccountAmountsList().stream()
1902+
.filter(aa -> aa.getAccountID().getAccountNum() < 1000)
1903+
.mapToInt(aa -> (int) aa.getAmount())
1904+
.sum();
1905+
assertEquals(record.getTransactionFee(), feeCreditSum);
1906+
}
1907+
18971908
@HapiTest
18981909
@DisplayName("Submit ot topic with multiple 3 layers fee should have 0 child records")
18991910
final Stream<DynamicTest> submitToTopicWithMultiple3layersFee() {

0 commit comments

Comments
 (0)