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

Commit f764c61

Browse files
committed
check for empty orderID
1 parent 839783a commit f764c61

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

core/disputes.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ func (n *OpenBazaarNode) verifyEscrowFundsAreDisputeable(contract *pb.RicardianC
172172
log.Errorf("Failed NewHashFromStr(%s): %s", r.Txid, err.Error())
173173
return false
174174
}
175+
if hash == nil {
176+
log.Errorf("Nil NewHashFromStr(%s)", r.Txid)
177+
return false
178+
}
175179
actualConfirmations, _, err := wal.GetConfirmations(*hash)
176180
if err != nil {
177181
log.Errorf("Failed GetConfirmations(%s): %s", hash.String(), err.Error())

net/service/handlers.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,11 +1348,13 @@ func (service *OpenBazaarService) handleDisputeUpdate(p peer.ID, pmes *pb.Messag
13481348
}
13491349

13501350
orderID := update.OrderId
1351-
err = service.node.Datastore.Messages().Put(
1352-
fmt.Sprintf("%s-%d", orderID, int(pb.Message_DISPUTE_UPDATE)),
1353-
orderID, pb.Message_DISPUTE_UPDATE, p.Pretty(), repo.Message{Msg: *pmes}, "", time.Now().UnixNano(), []byte(p))
1354-
if err != nil {
1355-
log.Errorf("failed putting message (%s-%d): %v", orderID, int(pb.Message_DISPUTE_UPDATE), err)
1351+
if orderID != "" {
1352+
err = service.node.Datastore.Messages().Put(
1353+
fmt.Sprintf("%s-%d", orderID, int(pb.Message_DISPUTE_UPDATE)),
1354+
orderID, pb.Message_DISPUTE_UPDATE, p.Pretty(), repo.Message{Msg: *pmes}, "", time.Now().UnixNano(), []byte(p))
1355+
if err != nil {
1356+
log.Errorf("failed putting message (%s-%d): %v", orderID, int(pb.Message_DISPUTE_UPDATE), err)
1357+
}
13561358
}
13571359

13581360
dispute, err := service.node.Datastore.Cases().GetByCaseID(update.OrderId)
@@ -1450,11 +1452,13 @@ func (service *OpenBazaarService) handleDisputeClose(p peer.ID, pmes *pb.Message
14501452
}
14511453

14521454
orderID := rc.DisputeResolution.OrderId
1453-
err = service.node.Datastore.Messages().Put(
1454-
fmt.Sprintf("%s-%d", orderID, int(pb.Message_DISPUTE_CLOSE)),
1455-
orderID, pb.Message_DISPUTE_CLOSE, p.Pretty(), repo.Message{Msg: *pmes}, "", time.Now().UnixNano(), []byte(p))
1456-
if err != nil {
1457-
log.Errorf("failed putting message (%s-%d): %v", orderID, int(pb.Message_DISPUTE_CLOSE), err)
1455+
if orderID != "" {
1456+
err = service.node.Datastore.Messages().Put(
1457+
fmt.Sprintf("%s-%d", orderID, int(pb.Message_DISPUTE_CLOSE)),
1458+
orderID, pb.Message_DISPUTE_CLOSE, p.Pretty(), repo.Message{Msg: *pmes}, "", time.Now().UnixNano(), []byte(p))
1459+
if err != nil {
1460+
log.Errorf("failed putting message (%s-%d): %v", orderID, int(pb.Message_DISPUTE_CLOSE), err)
1461+
}
14581462
}
14591463

14601464
// Load the order

qa/testdata/eth_listing.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"name": "A",
1919
"currencyType": "A"
2020
},
21-
"bigPrice": "120000000000000",
21+
"bigPrice": "4500000000000000",
2222
"tags": [
2323
"tshirts",
2424
"clothing",

vendor/github.com/OpenBazaar/go-ethwallet/wallet/wallet.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)