Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboehm committed Nov 28, 2021
1 parent ae4cb2f commit e143215
Show file tree
Hide file tree
Showing 64 changed files with 87 additions and 94 deletions.
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Blockbook Contributor Guide

Blockbook is back-end service for Trezor wallet. Although it is open source, the design and development of the core packages
is done by Trezor developers in order to keep Blockbook compatible with Trezor.
Blockbook is a back-end service for the Trezor wallet. Although it is open source, the design and development of the core packages
is done by the Trezor developers to keep Blockbook compatible with Trezor.

Bug fixes and support for new coins are welcome. **Please take note that non-fixing pull requests that change base
packages or another coin code will not be accepted.** If you have a need to change some of the existing code, please file
an issue and discuss your request with Blockbook maintainers.
Bug fixes and support for new coins are welcome. **Please take note that pull requests that are not fixes and that change base
packages or another coin code will not be accepted.** If you need a change in the existing core code, please file
an issue and discuss your request with the Blockbook maintainers.

## Development environment

Expand All @@ -16,8 +16,8 @@ Instructions to set up your development environment and build Blockbook are desc

### Reporting bugs

A great way to contribute to the project is to send a detailed report when you encounter an issue. We always appreciate
a well-written, thorough bug report, and will thank you for it!
A great way to contribute to the project is to send a detailed report when you encounter a problem. We always appreciate
a well-written and thorough bug report, and we'll be grateful for it!

Check that [our issue database](https://github.com/trezor/blockbook/issues) doesn't already include that problem or
suggestion before submitting an issue. If you find a match, you can use the "subscribe" button to get notified on
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
**Blockbook** is back-end service for Trezor wallet. Main features of **Blockbook** are:

- index of addresses and address balances of the connected block chain
- fast searches in the indexes
- fast index search
- simple blockchain explorer
- websocket, API and legacy Bitcore Insight compatible socket.io interfaces
- support of multiple coins (Bitcoin and Ethereum type), with easy extensibility for other coins
- support of multiple coins (Bitcoin and Ethereum type) with easy extensibility to other coins
- scripts for easy creation of debian packages for backend and blockbook

## Build and installation instructions
Expand Down Expand Up @@ -51,7 +51,8 @@ Please add your experience to this [issue](https://github.com/trezor/blockbook/i

#### Error `internalState: database is in inconsistent state and cannot be used`

Blockbook was killed during the initial import, most commonly by OOM killer. By default, Blockbook performs the initial import in bulk import mode, which for performance reasons does not store all the data immediately to the database. If Blockbook is killed during this phase, the database is left in an inconsistent state.
Blockbook was killed during the initial import, most commonly by OOM killer.
By default, Blockbook performs the initial import in bulk import mode, which for performance reasons does not store all data immediately to the database. If Blockbook is killed during this phase, the database is left in an inconsistent state.

See above how to reduce the memory footprint, delete the database files and run the import again.

Expand All @@ -67,9 +68,9 @@ Your coin's block/transaction data may not be compatible with `BitcoinParser` `P

#### Cannot build Blockbook using `go build` command

When building Blockbook, I get error `not enough arguments in call to _Cfunc_rocksdb_approximate_sizes`.
When building Blockbook I get error `not enough arguments in call to _Cfunc_rocksdb_approximate_sizes`.

RocksDB version 6.16.0 changed the API in backward incompatible way. It is necessary to build Blockbook with the tag `rocksdb_6_16`, which fixes the compatibility issue. The correct way to build Blockbook is:
RocksDB version 6.16.0 changed the API in a backwards incompatible way. It is necessary to build Blockbook with the `rocksdb_6_16` tag to fix the compatibility problem. The correct way to build Blockbook is:

```
go build -tags rocksdb_6_16
Expand Down
2 changes: 1 addition & 1 deletion api/types_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package api

Expand Down
2 changes: 1 addition & 1 deletion bchain/baseparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package bchain

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/bch/bcashparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package bch

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/bellcoin/bellcoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package bellcoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/bitcore/bitcoreparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package bitcore

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/bitzeny/bitzenyparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package bitzeny

Expand Down
1 change: 0 additions & 1 deletion bchain/coins/btc/bitcoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build unittest
// +build unittest

package btc

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/btg/bgoldparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package btg

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/dash/dashparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package dash

Expand Down
1 change: 0 additions & 1 deletion bchain/coins/dcr/decredparser_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build unittest
// +build unittest

package dcr

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/dcr/decredrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewDecredRPC(config json.RawMessage, pushHandler func(bchain.NotificationTy
Dial: (&net.Dialer{KeepAlive: 600 * time.Second}).Dial,
MaxIdleConns: 100,
MaxIdleConnsPerHost: 100, // necessary to not to deplete ports
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}

d := &DecredRPC{
Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/deeponion/deeponionparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package deeponion

Expand Down
4 changes: 2 additions & 2 deletions bchain/coins/digibyte/digibyteparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"github.com/trezor/blockbook/bchain/coins/btc"
)

// network constants
const (
// MainnetMagic is mainnet network constant
MainnetMagic wire.BitcoinNet = 0xdab6c3fa
TestnetMagic wire.BitcoinNet = 0xddbdc8fd
)

// parser parameters
var (
// MainNetParams are parser parameters for mainnet
MainNetParams chaincfg.Params
TestNetParams chaincfg.Params
)
Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/digibyte/digibyteparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package digibyte

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/divi/diviparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package divi

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/dogecoin/dogecoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package dogecoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/eth/erc20_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package eth

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/eth/ethparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package eth

Expand Down
8 changes: 4 additions & 4 deletions bchain/coins/firo/firoparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ const (
TestnetMagic wire.BitcoinNet = 0xcffcbeea
RegtestMagic wire.BitcoinNet = 0xfabfb5da

GenesisBlockTime = 1414776286
SwitchToMTPBlockHeader = 1544443200
GenesisBlockTime = 1414776286
SwitchToMTPBlockHeader = 1544443200
SwitchToProgPowBlockHeaderTestnet = 1630069200
SwitchToProgPowBlockHeaderMainnet = 1635228000
MTPL = 64
MTPL = 64

SpendTxID = "0000000000000000000000000000000000000000000000000000000000000000"

Expand Down Expand Up @@ -159,7 +159,7 @@ func (p *FiroParser) ParseBlock(b []byte) (*bchain.Block, error) {
}

// then ProgPow or MTP header
if(isProgPow(header, p.Params.Net == TestnetMagic)){
if isProgPow(header, p.Params.Net == TestnetMagic) {
progPowHeader := ProgPowBlockHeader{}

// header
Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/firo/firoparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package firo

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/flo/floparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package flo

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/fujicoin/fujicoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package fujicoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/gamecredits/gamecreditsparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package gamecredits

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/grs/grsparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type GroestlcoinParser struct {
func NewGroestlcoinParser(params *chaincfg.Params, c *btc.Configuration) *GroestlcoinParser {
return &GroestlcoinParser{
BitcoinParser: btc.NewBitcoinParser(params, c),
baseparser: &bchain.BaseParser{},
baseparser: &bchain.BaseParser{},
}
}

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/grs/grsparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package grs

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/koto/kotoparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package koto

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/liquid/liquidparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package liquid

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/litecoin/litecoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package litecoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/monacoin/monacoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package monacoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/monetaryunit/monetaryunitparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package monetaryunit

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/myriad/myriadparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package myriad

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/namecoin/namecoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package namecoin

Expand Down
1 change: 0 additions & 1 deletion bchain/coins/nuls/nulsparser_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build unittest
// +build unittest

package nuls

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/omotenashicoin/omotenashicoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package omotenashicoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/pivx/pivxparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package pivx

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/polis/polisparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package polis

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/qtum/qtumparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package qtum

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/ravencoin/ravencoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package ravencoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/ritocoin/ritocoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package ritocoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/snowgem/snowgemparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package snowgem

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/trezarcoin/trezarcoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package trezarcoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/unobtanium/unobtaniumparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package unobtanium

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/vertcoin/vertcoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package vertcoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/viacoin/viacoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package viacoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/vipstarcoin/vipstarcoinparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package vipstarcoin

Expand Down
2 changes: 1 addition & 1 deletion bchain/coins/zec/zcashparser_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build unittest
//go:build unittest

package zec

Expand Down
2 changes: 2 additions & 0 deletions bchain/coins/zec/zcashrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type ZCashRPC struct {
*btc.BitcoinRPC
}

// ResGetBlockChainInfo is a response to GetChainInfo request
type ResGetBlockChainInfo struct {
Error *bchain.RPCError `json:"error"`
Result struct {
Expand Down Expand Up @@ -72,6 +73,7 @@ func (z *ZCashRPC) Initialize() error {
return nil
}

// GetChainInfo return info about the blockchain
func (z *ZCashRPC) GetChainInfo() (*bchain.ChainInfo, error) {
chainInfo := ResGetBlockChainInfo{}
err := z.Call(&btc.CmdGetBlockChainInfo{Method: "getblockchaininfo"}, &chainInfo)
Expand Down
Loading

0 comments on commit e143215

Please sign in to comment.