Skip to content

Commit

Permalink
add replace to token inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlyp committed Sep 6, 2022
1 parent 6ec9f8f commit cfa85f9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions politeiawww/cmswww.go
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,16 @@ func (p *politeiawww) handlePassThroughTokenInventory(w http.ResponseWriter, r *
return
}

oldTokens := tir1.Approved
for i, token := range oldTokens {
log.Infof("inventory checking token, %s", token)
if newToken, ok := tlogTokens[token]; ok {
log.Infof("inventory found token, %s replacing with %s", token, newToken)
oldTokens[i] = newToken
}
}
tir1.Approved = oldTokens

reply, err := json.Marshal(tir1)
if err != nil {
RespondWithError(w, r, 0, "handlePassThroughTokenInventory: marshal both reply",
Expand All @@ -1104,6 +1114,7 @@ func (p *politeiawww) handlePassThroughBatchProposals(w http.ResponseWriter, r *
})
return
}

oldTokens := bp.Tokens
for i, token := range oldTokens {
log.Infof("checking token, %s", token)
Expand Down

0 comments on commit cfa85f9

Please sign in to comment.