diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..cd79448 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,33 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + build-and-test: + name: Build, Vet & Test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Build + run: go build ./... + + - name: Vet + run: go vet ./... + + - name: Test + run: go test -timeout 20m ./... diff --git a/wallet/service.go b/wallet/service.go index 03fe35b..e61c03e 100644 --- a/wallet/service.go +++ b/wallet/service.go @@ -226,7 +226,8 @@ func (ws *WalletService) RelayFee() (float32, error) { return 0, electrum.ErrServerShutdown } - ctx, _ := context.WithTimeout(context.Background(), time.Second*10) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) + defer cancel() return ws.electrumClient.GetRelayFee(ctx) } @@ -239,7 +240,8 @@ func (ws *WalletService) EstimateFee(target uint32) (float32, error) { return 0, electrum.ErrServerShutdown } - ctx, _ := context.WithTimeout(context.Background(), time.Second*10) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) + defer cancel() return ws.electrumClient.GetFee(ctx, target) }