Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2093 from OpenBazaar/brian.fixDisputeBug
Browse files Browse the repository at this point in the history
Fix input values for legacy dispute resolutions
  • Loading branch information
hoffmabc committed Jul 16, 2020
2 parents 54560b6 + 4b94562 commit e07c2cc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion repo/dispute_resolution.go
@@ -1,9 +1,11 @@
package repo

import (
"math/big"
"strconv"

"github.com/OpenBazaar/openbazaar-go/pb"
"github.com/golang/protobuf/proto"
"math/big"
)

// ToV5DisputeResolution scans through the dispute resolution looking for any deprecated fields and
Expand All @@ -14,6 +16,13 @@ func ToV5DisputeResolution(disputeResolution *pb.DisputeResolution) *pb.DisputeR
return newDisputeResolution
}

for i, input := range disputeResolution.Payout.Inputs {
if input.Value != 0 && input.BigValue == "" {
input.BigValue = strconv.FormatUint(input.Value, 10)
newDisputeResolution.Payout.Inputs[i] = input
}
}

if disputeResolution.Payout.BuyerOutput != nil &&
disputeResolution.Payout.BuyerOutput.Amount != 0 &&
disputeResolution.Payout.BuyerOutput.BigAmount == "" {
Expand Down

0 comments on commit e07c2cc

Please sign in to comment.