File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ export function getExecutionCost(
69
69
if ( isInitiator === false ) res -= BigInt ( params . responderAmountFinal ) ;
70
70
}
71
71
if (
72
- ( ( params . tag === Tag . SpendTx && params . senderId !== params . recipientId )
72
+ ( params . tag === Tag . SpendTx
73
73
|| params . tag === Tag . ContractCreateTx || params . tag === Tag . ContractCallTx
74
74
|| params . tag === Tag . ChannelDepositTx ) && innerTx !== 'fee-payer'
75
75
) {
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ describe('Execution cost', () => {
39
39
40
40
it ( 'calculates execution cost for spend tx' , async ( ) => {
41
41
const { rawTx } = await aeSdk . spend ( 100 , aeSdk . address , { ttl : 0 } ) ;
42
- const expectedCost = 16660000000000n ;
42
+ const expectedCost = 16660000000000n + 100n ;
43
43
expect ( getExecutionCostBySignedTx ( rawTx , networkId ) ) . to . equal ( expectedCost ) ;
44
44
expect ( getExecutionCost ( buildTx ( unpackTx ( rawTx , Tag . SignedTx ) . encodedTx ) ) )
45
45
. to . equal ( expectedCost ) ;
@@ -86,6 +86,8 @@ describe('Execution cost', () => {
86
86
// Can't detect Oracle.respond reward in contract call
87
87
if ( balanceDiff === - 501000n ) return ;
88
88
expect ( balanceDiff ) . to . be . equal ( 0n ) ;
89
+ } else if ( params . tag === Tag . SpendTx && params . senderId === params . recipientId ) {
90
+ expect ( balanceDiff ) . to . be . equal ( BigInt ( - params . amount ) ) ;
89
91
} else {
90
92
expect ( balanceDiff ) . to . be . equal ( 0n ) ;
91
93
}
You can’t perform that action at this time.
0 commit comments