Fix formatting/linting issues

balanceHistory
Martin Boehm 2019-11-19 11:15:00 +01:00
parent e754a6c0fd
commit 5600e0d30a
4 changed files with 43 additions and 44 deletions

View File

@ -9,7 +9,7 @@ import (
"blockbook/bchain/coins/cpuchain"
"blockbook/bchain/coins/dash"
"blockbook/bchain/coins/dcr"
"blockbook/bchain/coins/deeponion"
"blockbook/bchain/coins/deeponion"
"blockbook/bchain/coins/digibyte"
"blockbook/bchain/coins/divi"
"blockbook/bchain/coins/dogecoin"
@ -104,7 +104,7 @@ func init() {
BlockChainFactories["Divi"] = divi.NewDiviRPC
BlockChainFactories["CPUchain"] = cpuchain.NewCPUchainRPC
BlockChainFactories["Unobtanium"] = unobtanium.NewUnobtaniumRPC
BlockChainFactories["DeepOnion"] = deeponion.NewDeepOnionRPC
BlockChainFactories["DeepOnion"] = deeponion.NewDeepOnionRPC
}
// GetCoinNameFromConfig gets coin name and coin shortcut from config file

View File

@ -1,7 +1,7 @@
package deeponion
import (
"blockbook/bchain"
"blockbook/bchain"
"blockbook/bchain/coins/btc"
"github.com/martinboehm/btcd/wire"
@ -35,8 +35,8 @@ type DeepOnionParser struct {
// NewDeepOnionParser returns new DeepOnionParser instance
func NewDeepOnionParser(params *chaincfg.Params, c *btc.Configuration) *DeepOnionParser {
return &DeepOnionParser{
BitcoinParser: btc.NewBitcoinParser(params, c),
baseparser: &bchain.BaseParser{},
BitcoinParser: btc.NewBitcoinParser(params, c),
baseparser: &bchain.BaseParser{},
}
}

View File

@ -20,7 +20,6 @@ func TestMain(m *testing.M) {
os.Exit(c)
}
func Test_GetAddrDescFromAddress_Mainnet(t *testing.T) {
type args struct {
address string
@ -191,7 +190,7 @@ func Test_UnpackTx(t *testing.T) {
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("unpackTx(2) got = %v, want %v", got, tt.want)
t.Errorf("unpackTx(2) got = %v, want %v", got, tt.want)
}
if got1 != tt.want1 {
t.Errorf("unpackTx(3) got1 = %v, want %v", got1, tt.want1)

View File

@ -60,50 +60,50 @@ func (b *DeepOnionRPC) Initialize() error {
// GetBlock returns block with given hash.
func (s *DeepOnionRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) {
var err error
if hash == "" && height > 0 {
hash, err = s.GetBlockHash(height)
if err != nil {
return nil, err
}
}
var err error
if hash == "" && height > 0 {
hash, err = s.GetBlockHash(height)
if err != nil {
return nil, err
}
}
glog.V(1).Info("rpc: getblock (verbosity=1) ", hash)
glog.V(1).Info("rpc: getblock (verbosity=1) ", hash)
res := btc.ResGetBlockThin{}
req := btc.CmdGetBlock{Method: "getblock"}
req.Params.BlockHash = hash
req.Params.Verbosity = 1
err = s.Call(&req, &res)
res := btc.ResGetBlockThin{}
req := btc.CmdGetBlock{Method: "getblock"}
req.Params.BlockHash = hash
req.Params.Verbosity = 1
err = s.Call(&req, &res)
if err != nil {
return nil, errors.Annotatef(err, "hash %v", hash)
}
if res.Error != nil {
return nil, errors.Annotatef(res.Error, "hash %v", hash)
}
if err != nil {
return nil, errors.Annotatef(err, "hash %v", hash)
}
if res.Error != nil {
return nil, errors.Annotatef(res.Error, "hash %v", hash)
}
txs := make([]bchain.Tx, 0, len(res.Result.Txids))
for _, txid := range res.Result.Txids {
tx, err := s.GetTransaction(txid)
if err != nil {
if err == bchain.ErrTxNotFound {
glog.Errorf("rpc: getblock: skipping transanction in block %s due error: %s", hash, err)
continue
}
return nil, err
}
txs = append(txs, *tx)
}
block := &bchain.Block{
BlockHeader: res.Result.BlockHeader,
Txs: txs,
}
return block, nil
txs := make([]bchain.Tx, 0, len(res.Result.Txids))
for _, txid := range res.Result.Txids {
tx, err := s.GetTransaction(txid)
if err != nil {
if err == bchain.ErrTxNotFound {
glog.Errorf("rpc: getblock: skipping transanction in block %s due error: %s", hash, err)
continue
}
return nil, err
}
txs = append(txs, *tx)
}
block := &bchain.Block{
BlockHeader: res.Result.BlockHeader,
Txs: txs,
}
return block, nil
}
// GetTransactionForMempool returns a transaction by the transaction ID.
// It could be optimized for mempool, i.e. without block time and confirmations
func (s *DeepOnionRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error) {
return s.GetTransaction(txid)
return s.GetTransaction(txid)
}