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

Commit 1c9222c

Browse files
authored
Merge pull request #2018 from OpenBazaar/zero_mod_fee
(#2002, 2005, 2006, 2012) Handle zero mod fee
2 parents 3af0d98 + d630f09 commit 1c9222c

File tree

5 files changed

+35
-20
lines changed

5 files changed

+35
-20
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: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,11 +1309,13 @@ func (service *OpenBazaarService) handleDisputeOpen(p peer.ID, pmes *pb.Message,
13091309
log.Errorf("failed calc orderID")
13101310
}
13111311

1312-
err = service.node.Datastore.Messages().Put(
1313-
fmt.Sprintf("%s-%d", orderID, int(pb.Message_DISPUTE_OPEN)),
1314-
orderID, pb.Message_DISPUTE_OPEN, p.Pretty(), repo.Message{Msg: *pmes}, "", time.Now().UnixNano(), []byte(p))
1315-
if err != nil {
1316-
log.Errorf("failed putting message (%s-%d): %v", orderID, int(pb.Message_DISPUTE_OPEN), err)
1312+
if orderID != "" {
1313+
err = service.node.Datastore.Messages().Put(
1314+
fmt.Sprintf("%s-%d", orderID, int(pb.Message_DISPUTE_OPEN)),
1315+
orderID, pb.Message_DISPUTE_OPEN, p.Pretty(), repo.Message{Msg: *pmes}, "", time.Now().UnixNano(), []byte(p))
1316+
if err != nil {
1317+
log.Errorf("failed putting message (%s-%d): %v", orderID, int(pb.Message_DISPUTE_OPEN), err)
1318+
}
13171319
}
13181320

13191321
// Verify signature
@@ -1346,11 +1348,13 @@ func (service *OpenBazaarService) handleDisputeUpdate(p peer.ID, pmes *pb.Messag
13461348
}
13471349

13481350
orderID := update.OrderId
1349-
err = service.node.Datastore.Messages().Put(
1350-
fmt.Sprintf("%s-%d", orderID, int(pb.Message_DISPUTE_UPDATE)),
1351-
orderID, pb.Message_DISPUTE_UPDATE, p.Pretty(), repo.Message{Msg: *pmes}, "", time.Now().UnixNano(), []byte(p))
1352-
if err != nil {
1353-
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+
}
13541358
}
13551359

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

14501454
orderID := rc.DisputeResolution.OrderId
1451-
err = service.node.Datastore.Messages().Put(
1452-
fmt.Sprintf("%s-%d", orderID, int(pb.Message_DISPUTE_CLOSE)),
1453-
orderID, pb.Message_DISPUTE_CLOSE, p.Pretty(), repo.Message{Msg: *pmes}, "", time.Now().UnixNano(), []byte(p))
1454-
if err != nil {
1455-
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+
}
14561462
}
14571463

14581464
// 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: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/OpenBazaar/multiwallet/client/blockbook/client.go

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

0 commit comments

Comments
 (0)