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

Commit 9fa6f70

Browse files
committed
fix: Pass orderID when sending dispute
OrderID wasn't properly being extracted previously
1 parent aef943a commit 9fa6f70

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

core/disputes.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (n *OpenBazaarNode) OpenDispute(orderID string, contract *pb.RicardianContr
110110
contract.Signatures = append(contract.Signatures, rc.Signatures[0])
111111

112112
// Send to moderator
113-
err = n.SendDisputeOpen(order.Payment.Moderator, nil, rc)
113+
err = n.SendDisputeOpen(order.Payment.Moderator, nil, rc, orderID)
114114
if err != nil {
115115
return err
116116
}
@@ -131,7 +131,7 @@ func (n *OpenBazaarNode) OpenDispute(orderID string, contract *pb.RicardianContr
131131
return nil
132132
}
133133
}
134-
err = n.SendDisputeOpen(counterparty, &counterkey, rc)
134+
err = n.SendDisputeOpen(counterparty, &counterkey, rc, orderID)
135135
if err != nil {
136136
return err
137137
}

core/net.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ func (n *OpenBazaarNode) SendOrderCompletion(peerID string, k *libp2p.PubKey, co
524524
}
525525

526526
// SendDisputeOpen - send open dispute msg to peer
527-
func (n *OpenBazaarNode) SendDisputeOpen(peerID string, k *libp2p.PubKey, disputeMessage *pb.RicardianContract) error {
527+
func (n *OpenBazaarNode) SendDisputeOpen(peerID string, k *libp2p.PubKey, disputeMessage *pb.RicardianContract, orderID string) error {
528528
a, err := ptypes.MarshalAny(disputeMessage)
529529
if err != nil {
530530
log.Errorf("failed to marshal the contract: %v", err)
@@ -538,19 +538,16 @@ func (n *OpenBazaarNode) SendDisputeOpen(peerID string, k *libp2p.PubKey, disput
538538
}
539539

540540
// Save DISPUTE_OPEN message to the database for this order for resending if necessary
541-
var orderID0 string
542-
if disputeMessage.VendorOrderConfirmation != nil {
543-
orderID0 = disputeMessage.VendorOrderConfirmation.OrderID
544-
if orderID0 == "" {
545-
log.Errorf("failed fetching orderID")
546-
} else {
541+
orderID0 := orderID
542+
if orderID0 == "" {
543+
log.Errorf("failed fetching orderID")
544+
} else {
547545
err = n.Datastore.Messages().Put(
548546
fmt.Sprintf("%s-%d", orderID0, int(pb.Message_DISPUTE_OPEN)),
549547
orderID0, pb.Message_DISPUTE_OPEN, peerID, repo.Message{Msg: m},
550548
"", 0, []byte{})
551549
if err != nil {
552-
log.Errorf("failed putting message (%s-%d): %v", orderID0, int(pb.Message_DISPUTE_OPEN), err)
553-
}
550+
log.Errorf("failed putting message (%s-%d): %v", orderID0, int(pb.Message_DISPUTE_OPEN), err)
554551
}
555552
}
556553

0 commit comments

Comments
 (0)