54
54
import static com .hederahashgraph .api .proto .java .ResponseCodeEnum .NO_VALID_MAX_CUSTOM_FEE ;
55
55
import static com .hederahashgraph .api .proto .java .ResponseCodeEnum .SUCCESS ;
56
56
import static com .hederahashgraph .api .proto .java .ResponseCodeEnum .TOKEN_NOT_ASSOCIATED_TO_ACCOUNT ;
57
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
57
58
import static org .junit .jupiter .api .Assertions .assertTrue ;
58
59
59
60
import com .hedera .services .bdd .junit .HapiTest ;
68
69
import com .hederahashgraph .api .proto .java .ResponseCodeEnum ;
69
70
import com .hederahashgraph .api .proto .java .TokenID ;
70
71
import com .hederahashgraph .api .proto .java .TokenType ;
72
+ import com .hederahashgraph .api .proto .java .TransactionRecord ;
71
73
import edu .umd .cs .findbugs .annotations .NonNull ;
72
74
import java .util .Arrays ;
73
75
import java .util .stream .Stream ;
@@ -1885,6 +1887,7 @@ final Stream<DynamicTest> submitToTopicWith3layersFee() {
1885
1887
.hasNonStakingChildRecordCount (0 )
1886
1888
.logged ();
1887
1889
allRunFor (spec , submitTxnRecord );
1890
+ validateTransactionFees (submitTxnRecord .getResponseRecord ());
1888
1891
}),
1889
1892
// assert topic fee collector balance
1890
1893
getAccountBalance (collector ).hasTokenBalance (tokenName , 1 ),
@@ -1894,6 +1897,14 @@ final Stream<DynamicTest> submitToTopicWith3layersFee() {
1894
1897
.hasTinyBars (ONE_HBAR )));
1895
1898
}
1896
1899
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
+
1897
1908
@ HapiTest
1898
1909
@ DisplayName ("Submit ot topic with multiple 3 layers fee should have 0 child records" )
1899
1910
final Stream <DynamicTest > submitToTopicWithMultiple3layersFee () {
0 commit comments