Skip to content

Commit

Permalink
fix withdraw log
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanyan committed Jan 13, 2021
1 parent 9ec6652 commit e54a723
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions staking/take_effect_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,19 +360,22 @@ func addWithdrawLog(ctx *messageContext, newVal *state.Validator, receipt, deleg
progLogMsg = "delegator withdraw record"
}

// build withdraw log
data := getWithdrawLogData(completionHeight, stakeDelta.Uint64(), withdrawToken, changed, vStatus, dStatus)
rLog := &types.Log{
Address: params.StakingModuleAddress,
Topics: []common.Hash{common.StringToHash(topic), newVal.MainAddress().Hash()},
Data: data,
BlockNumber: creationHeight,
}
if isValidator {
rLog.Topics = append(rLog.Topics, delegator.Hash())
// fix withdraw log on YouV5
if ctx.Cfg.Version >= params.YouV5 {
// build withdraw log
data := getWithdrawLogData(completionHeight, stakeDelta.Uint64(), withdrawToken, changed, vStatus, dStatus)
rLog := &types.Log{
Address: params.StakingModuleAddress,
Topics: []common.Hash{common.StringToHash(topic), newVal.MainAddress().Hash()},
Data: data,
BlockNumber: creationHeight,
}
if isValidator {
rLog.Topics = append(rLog.Topics, delegator.Hash())
}
// append log to current end-block receipt.
ctx.Receipt.Logs = append(ctx.Receipt.Logs, rLog)
}
// append log to current end-block receipt.
ctx.Receipt.Logs = append(ctx.Receipt.Logs)

log.Info(progLogMsg, "operator", ctx.Msg.From(), "val", newVal.MainAddress().String(), "receipt", receipt, "withdrawToken", withdrawToken, "newToken", newToken, "stakeDelta", stakeDelta, "newStake", newStake, "creationHeight", creationHeight, "complete", completionHeight, "withdrawAmountChanged", changed)
}
Expand Down

0 comments on commit e54a723

Please sign in to comment.