@@ -162,38 +162,38 @@ func (p *Protocol) Handle(
162
162
rlog , err := p .Deposit (ctx , sm , act .Amount (), iotextypes .TransactionLogType_DEPOSIT_TO_REWARDING_FUND )
163
163
if err != nil {
164
164
log .L ().Debug ("Error when handling rewarding action" , zap .Error (err ))
165
- return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Failure ), si )
165
+ return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Failure ), si , nil )
166
166
}
167
- return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Success ), si , rlog )
167
+ return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Success ), si , nil , rlog )
168
168
case * action.ClaimFromRewardingFund :
169
169
si := sm .Snapshot ()
170
170
rlog , err := p .Claim (ctx , sm , act .Amount ())
171
171
if err != nil {
172
172
log .L ().Debug ("Error when handling rewarding action" , zap .Error (err ))
173
- return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Failure ), si )
173
+ return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Failure ), si , nil )
174
174
}
175
- return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Success ), si , rlog )
175
+ return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Success ), si , nil , rlog )
176
176
case * action.GrantReward :
177
177
switch act .RewardType () {
178
178
case action .BlockReward :
179
179
si := sm .Snapshot ()
180
180
rewardLog , err := p .GrantBlockReward (ctx , sm )
181
181
if err != nil {
182
182
log .L ().Debug ("Error when handling rewarding action" , zap .Error (err ))
183
- return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Failure ), si )
183
+ return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Failure ), si , nil )
184
184
}
185
185
if rewardLog == nil {
186
- return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Success ), si )
186
+ return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Success ), si , nil )
187
187
}
188
- return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Success ), si , rewardLog )
188
+ return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Success ), si , [] * action. Log { rewardLog } )
189
189
case action .EpochReward :
190
190
si := sm .Snapshot ()
191
191
rewardLogs , err := p .GrantEpochReward (ctx , sm )
192
192
if err != nil {
193
193
log .L ().Debug ("Error when handling rewarding action" , zap .Error (err ))
194
- return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Failure ), si )
194
+ return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Failure ), si , nil )
195
195
}
196
- return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Success ), si , rewardLogs ... )
196
+ return p .settleAction (ctx , sm , uint64 (iotextypes .ReceiptStatus_Success ), si , rewardLogs )
197
197
}
198
198
}
199
199
return nil , nil
@@ -337,7 +337,8 @@ func (p *Protocol) settleAction(
337
337
sm protocol.StateManager ,
338
338
status uint64 ,
339
339
si int ,
340
- logs ... * action.Log ,
340
+ logs []* action.Log ,
341
+ tLogs ... * action.TransactionLog ,
341
342
) (* action.Receipt , error ) {
342
343
actionCtx := protocol .MustGetActionCtx (ctx )
343
344
blkCtx := protocol .MustGetBlockCtx (ctx )
@@ -352,12 +353,12 @@ func (p *Protocol) settleAction(
352
353
return nil , err
353
354
}
354
355
if depositLog != nil {
355
- logs = append (logs , depositLog )
356
+ tLogs = append (tLogs , depositLog )
356
357
}
357
358
if err := p .increaseNonce (sm , actionCtx .Caller , actionCtx .Nonce ); err != nil {
358
359
return nil , err
359
360
}
360
- return p .createReceipt (status , blkCtx .BlockHeight , actionCtx .ActionHash , actionCtx .IntrinsicGas , logs ... ), nil
361
+ return p .createReceipt (status , blkCtx .BlockHeight , actionCtx .ActionHash , actionCtx .IntrinsicGas , logs , tLogs ... ), nil
361
362
}
362
363
363
364
func (p * Protocol ) increaseNonce (sm protocol.StateManager , addr address.Address , nonce uint64 ) error {
@@ -377,16 +378,15 @@ func (p *Protocol) createReceipt(
377
378
blkHeight uint64 ,
378
379
actHash hash.Hash256 ,
379
380
gasConsumed uint64 ,
380
- logs ... * action.Log ,
381
+ logs []* action.Log ,
382
+ tLogs ... * action.TransactionLog ,
381
383
) * action.Receipt {
382
384
// TODO: need to review the fields
383
- r := & action.Receipt {
385
+ return ( & action.Receipt {
384
386
Status : status ,
385
387
BlockHeight : blkHeight ,
386
388
ActionHash : actHash ,
387
389
GasConsumed : gasConsumed ,
388
390
ContractAddress : p .addr .String (),
389
- }
390
- r .AddLogs (logs ... )
391
- return r
391
+ }).AddLogs (logs ... ).AddTransactionLogs (tLogs ... )
392
392
}
0 commit comments