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

Commit b663861

Browse files
committed
Merge remote-tracking branch 'origin/master' into ethereum-master
* origin/master: (23 commits) (#1919) Migrate to AddWatchedAddresses (#1920) Do not mark wallet address as watched + fix earlier txn errors Refactor zcash buildtx Import latest zcash changes Update make openbazaard command to not include tag Point Dockfiles at public Docker Hub repo; Add make help Bump version to 0.13.7 Update zcash branchID Remove unused imports Fix linter issues Update transports Update Bitcoin Cash rates dialer Refactor Dockerfile.dev to derive from latest Dockerfile.qa Refactor Dockerfile.qa Add openbazaard and qa targets to Makefile; Fix docker build targets Add QA docker commands to Makefile QA dockerfile Add qa.sh script Fix transports for message retriever and images Fix formatted logging messages ... Conflicts: Makefile net/service/handlers.go qa/runtests.sh vendor/github.com/OpenBazaar/multiwallet/bitcoin/wallet.go vendor/github.com/OpenBazaar/multiwallet/bitcoincash/exchange_rates.go vendor/github.com/OpenBazaar/multiwallet/bitcoincash/wallet.go vendor/github.com/OpenBazaar/multiwallet/litecoin/wallet.go vendor/github.com/OpenBazaar/multiwallet/zcash/exchange_rates.go vendor/github.com/OpenBazaar/multiwallet/zcash/wallet.go
2 parents dd8c424 + edb5cc6 commit b663861

File tree

40 files changed

+397
-217
lines changed

40 files changed

+397
-217
lines changed

Dockerfile.dev

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,4 @@
1-
FROM golang:1.11
2-
VOLUME /var/lib/openbazaar
3-
4-
RUN wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \
5-
tar xvf Python-3.6.0.tgz && \
6-
cd Python-3.6.0 && \
7-
./configure --enable-optimizations && \
8-
make -j8
9-
RUN apt-get update && apt-get install -yq zlib1g-dev libssl-dev unzip
10-
RUN cd Python-3.6.0 && \
11-
make altinstall && \
12-
ln -s /usr/local/bin/python3.6 /usr/local/bin/python3
13-
14-
COPY ./qa/requirements.txt ./requirements.txt
15-
16-
RUN pip3.6 install --upgrade pip && \
17-
pip3.6 install -r requirements.txt && \
18-
wget https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-0.16.3-x86_64-linux-gnu.tar.gz && \
19-
tar -xvzf bitcoin-0.16.3-x86_64-linux-gnu.tar.gz -C /opt
20-
21-
RUN wget https://github.com/google/protobuf/releases/download/v3.6.0/protoc-3.6.0-linux-x86_64.zip && \
22-
unzip ./protoc-3.6.0-linux-x86_64.zip -x readme.txt && \
23-
mv ./include/* /usr/local/include/ && \
24-
mv ./bin/protoc /usr/local/bin/ && \
25-
rm -rf ./include ./bin
1+
FROM openbazaar/server-qa:0.10
262

273
RUN go get -u github.com/gogo/protobuf/proto \
284
github.com/golang/protobuf/protoc-gen-go \

Dockerfile.qa

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM golang:1.11
2+
3+
ENV BITCOIND_VERSION=0.16.3
4+
ENV BITCOIND_PATH=/opt/bitcoin-${BITCOIND_VERSION}
5+
6+
# software installs, from most stable to most volatile
7+
RUN apt-get update -y
8+
RUN apt-get install -yq software-properties-common \
9+
zlib1g-dev \
10+
libssl-dev \
11+
unzip \
12+
python3 \
13+
python3-pip
14+
15+
RUN wget https://github.com/google/protobuf/releases/download/v3.6.0/protoc-3.6.0-linux-x86_64.zip && \
16+
unzip ./protoc-3.6.0-linux-x86_64.zip -x readme.txt && \
17+
mv ./include/* /usr/local/include/ && \
18+
mv ./bin/protoc /usr/local/bin/ && \
19+
rm -rf ./include ./bin
20+
21+
COPY ./qa/requirements.txt ./requirements.txt
22+
23+
RUN python3 -m pip install --upgrade pip && \
24+
pip install -r ./requirements.txt && \
25+
wget https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-${BITCOIND_VERSION}-x86_64-linux-gnu.tar.gz && \
26+
tar -xvzf bitcoin-${BITCOIND_VERSION}-x86_64-linux-gnu.tar.gz -C /opt
27+
28+
WORKDIR /go/src/github.com/OpenBazaar/openbazaar-go
29+
30+
COPY ./Makefile ./Makefile
31+
32+
VOLUME /go/src/github.com/OpenBazaar/openbazaar-go
33+
34+
CMD make qa_test

Makefile

Lines changed: 76 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1+
.DEFAULT_GOAL := help
2+
3+
##
4+
## Global ENV vars
5+
##
6+
7+
GIT_SHA ?= $(shell git rev-parse --short=8 HEAD)
8+
GIT_TAG ?= $(shell git describe --tags --abbrev=0)
9+
10+
##
11+
## Helpful Help
12+
##
13+
14+
.PHONY: help
15+
help:
16+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
17+
18+
119
##
220
## Building
321
##
422

5-
ios_framework:
23+
.PHONY: ios_framework
24+
ios_framework: ## Build iOS Framework for mobile
625
gomobile bind -target=ios github.com/OpenBazaar/openbazaar-go/mobile
726

8-
android_framework:
27+
.PHONY: android_framework
28+
android_framework: ## Build Android Framework for mobile
929
gomobile bind -target=android github.com/OpenBazaar/openbazaar-go/mobile
1030

1131
##
@@ -17,32 +37,62 @@ P_ANY = Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any
1737
PKGMAP = $(P_TIMESTAMP),$(P_ANY)
1838

1939
.PHONY: protos
20-
protos:
40+
protos: ## Build go files for proto definitions
2141
cd pb/protos && PATH=$(PATH):$(GOPATH)/bin protoc --go_out=$(PKGMAP):.. *.proto
2242

43+
44+
##
45+
## Testing
46+
##
47+
OPENBAZAARD_NAME ?= openbazaard-$(GIT_SHA)
48+
BITCOIND_PATH ?= .
49+
50+
.PHONY: openbazaard
51+
openbazaard: ## Build daemon
52+
$(info "Building openbazaar daemon...")
53+
go build -o ./$(OPENBAZAARD_NAME) .
54+
55+
.PHONY: qa_test
56+
qa_test: openbazaard ## Run QA test suite against current working copy
57+
$(info "Running QA... (openbazaard: ../$(OPENBAZAARD_NAME) bitcoind: $(BITCOIND_PATH)/bin/bitcoind)")
58+
(cd qa && ./runtests.sh ../$(OPENBAZAARD_NAME) $(BITCOIND_PATH)/bin/bitcoind)
59+
60+
.PHONY: qa_eth_test
61+
qa_eth_test: openbazaard ## Run ETH-based QA test suite against current working copy
62+
$(info "Running ETH QA... (openbazaard: ../$(OPENBAZAARD_NAME))")
63+
(cd qa && ./runtests_eth.sh ../$(OPENBAZAARD_NAME))
64+
2365
##
2466
## Docker
2567
##
26-
DOCKER_PROFILE ?= openbazaar
27-
DOCKER_VERSION ?= $(shell git describe --tags --abbrev=0)
28-
DOCKER_IMAGE_NAME ?= $(DOCKER_PROFILE)/server:$(DOCKER_VERSION)
29-
30-
.PHONY: docker
31-
docker:
32-
docker build -t $(DOCKER_IMAGE_NAME) .
33-
34-
.PHONY: push_docker
35-
push_docker:
36-
docker push $(DOCKER_IMAGE_NAME)
37-
38-
.PHONY: qa
39-
qa:
40-
go build -o ./openbazaar-qa ./openbazaard.go
41-
(cd qa && ./runtests.sh ../openbazaar-qa /opt/bitcoin-0.16.3/bin/bitcoind)
42-
rm ./openbazaar-qa
43-
44-
.PHONY: qa_eth
45-
qa_eth:
46-
go build -o ./openbazaar-qa ./openbazaard.go
47-
(cd qa && ./runtests_eth.sh ../openbazaar-qa)
48-
rm ./openbazaar-qa
68+
PUBLIC_DOCKER_REGISTRY ?= openbazaar
69+
QA_DEV_TAG ?= 0.10
70+
71+
DOCKER_SERVER_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server:$(GIT_TAG)
72+
DOCKER_QA_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server-qa:$(QA_DEV_TAG)
73+
DOCKER_DEV_IMAGE_NAME ?= $(PUBLIC_DOCKER_REGISTRY)/server-dev:$(QA_DEV_TAG)
74+
75+
76+
.PHONY: docker_build
77+
docker_build: ## Build container for daemon
78+
docker build -t $(DOCKER_SERVER_IMAGE_NAME) .
79+
80+
.PHONY: docker_push
81+
docker_push: docker ## Push container for daemon
82+
docker push $(DOCKER_SERVER_IMAGE_NAME)
83+
84+
.PHONY: qa_docker_build
85+
qa_docker_build: ## Build container with QA test dependencies included
86+
docker build -t $(DOCKER_QA_IMAGE_NAME) -f ./Dockerfile.qa .
87+
88+
.PHONY: qa_docker_push
89+
qa_docker_push: qa_docker_build ## Push container for daemon QA test environment
90+
docker push $(DOCKER_QA_IMAGE_NAME)
91+
92+
.PHONY: dev_docker_build
93+
dev_docker: ## Build container with dev dependencies included
94+
docker build -t $(DOCKER_DEV_IMAGE_NAME) -f ./Dockerfile.dev .
95+
96+
.PHONY: dev_docker_push
97+
dev_docker_push: dev_docker_build ## Push container for daemon dev environment
98+
docker push $(DOCKER_DEV_IMAGE_NAME)

cmd/start.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ import (
6161
)
6262

6363
var stdoutLogFormat = logging.MustStringFormatter(
64-
`%{color:reset}%{color}%{time:15:04:05.000} [%{level}] [%{module}/%{shortfunc}] %{message}`,
64+
`%{color:reset}%{color}%{time:2006-01-02 15:04:05.000} [%{level}] [%{module}/%{shortfunc}] %{message}`,
6565
)
6666

6767
var fileLogFormat = logging.MustStringFormatter(
68-
`%{time:15:04:05.000} [%{level}] [%{module}/%{shortfunc}] %{message}`,
68+
`%{time:2006-01-02 15:04:05.000} [%{level}] [%{module}/%{shortfunc}] %{message}`,
6969
)
7070

7171
var ErrNoGateways = errors.New("no gateway addresses configured")

core/core.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030

3131
const (
3232
// VERSION - current version
33-
VERSION = "0.13.6"
33+
VERSION = "0.13.7"
3434
// USERAGENT - user-agent header string
3535
USERAGENT = "/openbazaar-go:" + VERSION + "/"
3636
)

core/images.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
_ "image/png"
1010
"io"
1111
"io/ioutil"
12-
"net"
1312
"net/http"
1413
netUrl "net/url"
1514
"os"
@@ -167,12 +166,14 @@ func (n *OpenBazaarNode) FetchImage(peerID string, imageType string, size string
167166

168167
// GetBase64Image - fetch the image and return it as base64 encoded string
169168
func (n *OpenBazaarNode) GetBase64Image(url string) (base64ImageData, filename string, err error) {
170-
dial := net.Dial
169+
var client *http.Client
171170
if n.TorDialer != nil {
172-
dial = n.TorDialer.Dial
171+
tbTransport := &http.Transport{Dial: n.TorDialer.Dial}
172+
client = &http.Client{Transport: tbTransport, Timeout: time.Second * 30}
173+
} else {
174+
client = &http.Client{Timeout: time.Second * 30}
173175
}
174-
tbTransport := &http.Transport{Dial: dial}
175-
client := &http.Client{Transport: tbTransport, Timeout: time.Second * 30}
176+
176177
resp, err := client.Get(url)
177178
if err != nil {
178179
return "", "", err

core/order.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ func prepareModeratedOrderContract(data *repo.PurchaseData, n *OpenBazaarNode, c
278278
fee := wal.GetFeePerByte(wallet.NORMAL)
279279
contract.BuyerOrder.BigRefundFee = fee.String()
280280

281-
err = wal.AddWatchedAddress(addr)
281+
err = wal.AddWatchedAddresses(addr)
282282
if err != nil {
283283
return nil, err
284284
}
@@ -315,7 +315,7 @@ func processOnlineDirectOrder(resp *pb.Message, n *OpenBazaarNode, wal wallet.Wa
315315
if err != nil {
316316
return "", "", *big.NewInt(0), false, err
317317
}
318-
err = wal.AddWatchedAddress(addr)
318+
err = wal.AddWatchedAddresses(addr)
319319
if err != nil {
320320
return "", "", *big.NewInt(0), false, err
321321
}
@@ -374,7 +374,7 @@ func processOfflineDirectOrder(n *OpenBazaarNode, wal wallet.Wallet, contract *p
374374
payment.RedeemScript = hex.EncodeToString(redeemScript)
375375
payment.Chaincode = hex.EncodeToString(chaincode)
376376

377-
err = wal.AddWatchedAddress(addr)
377+
err = wal.AddWatchedAddresses(addr)
378378
if err != nil {
379379
return "", "", *big.NewInt(0), err
380380
}

core/ulimit_unix.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package core
44

55
import (
66
"fmt"
7+
"runtime"
78
"syscall"
89
)
910

@@ -27,6 +28,16 @@ func CheckAndSetUlimit() error {
2728
setting = true
2829
}
2930

31+
// If we're on darwin, work around the fact that Getrlimit reports
32+
// the wrong value. See https://github.com/golang/go/issues/30401
33+
if runtime.GOOS == "darwin" && rLimit.Cur > 10240 {
34+
// The max file limit is 10240, even though
35+
// the max returned by Getrlimit is 1<<63-1.
36+
// This is OPEN_MAX in sys/syslimits.h.
37+
rLimit.Max = 10240
38+
rLimit.Cur = 10240
39+
}
40+
3041
// Try updating the limit. If it fails, try using the previous maximum instead
3142
// of our new maximum. Not all users have permissions to increase the maximum.
3243
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
@@ -44,6 +55,6 @@ func CheckAndSetUlimit() error {
4455
return nil
4556
}
4657

47-
log.Debug("Successfully raised file descriptor limit to", fileDescriptorLimit)
58+
log.Debug("Successfully raised file descriptor limit to", rLimit.Cur)
4859
return nil
4960
}

docs/install-linux.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ It will use git to checkout the source code into `$GOPATH/src/github.com/OpenBaz
5454

5555
Checkout a release version:
5656
```
57-
git checkout v0.13.6
57+
git checkout v0.13.7
5858
```
5959

6060
Note: `go get` leaves the repo pointing at `master` which is a branch used for active development. Running OpenBazaar from `master` is NOT recommended. Check the [release versions](https://github.com/OpenBazaar/openbazaar-go/releases) for the available versions that you use in checkout.

docs/install-osx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ It will use git to checkout the source code into `$GOPATH/src/github.com/OpenBaz
5656

5757
Checkout a release version:
5858
```
59-
git checkout v0.13.6
59+
git checkout v0.13.7
6060
```
6161

6262
Note: `go get` leaves the repo pointing at `master` which is a branch used for active development. Running OpenBazaar from `master` is NOT recommended. Check the [release versions](https://github.com/OpenBazaar/openbazaar-go/releases) for the available versions that you use in checkout.

0 commit comments

Comments
 (0)