Fix formatting/linting issues
This commit is contained in:
parent
c45312edf1
commit
f7bbffa4c9
@ -9,7 +9,7 @@ import (
|
|||||||
"blockbook/bchain/coins/cpuchain"
|
"blockbook/bchain/coins/cpuchain"
|
||||||
"blockbook/bchain/coins/dash"
|
"blockbook/bchain/coins/dash"
|
||||||
"blockbook/bchain/coins/dcr"
|
"blockbook/bchain/coins/dcr"
|
||||||
"blockbook/bchain/coins/deeponion"
|
"blockbook/bchain/coins/deeponion"
|
||||||
"blockbook/bchain/coins/digibyte"
|
"blockbook/bchain/coins/digibyte"
|
||||||
"blockbook/bchain/coins/divi"
|
"blockbook/bchain/coins/divi"
|
||||||
"blockbook/bchain/coins/dogecoin"
|
"blockbook/bchain/coins/dogecoin"
|
||||||
@ -104,7 +104,7 @@ func init() {
|
|||||||
BlockChainFactories["Divi"] = divi.NewDiviRPC
|
BlockChainFactories["Divi"] = divi.NewDiviRPC
|
||||||
BlockChainFactories["CPUchain"] = cpuchain.NewCPUchainRPC
|
BlockChainFactories["CPUchain"] = cpuchain.NewCPUchainRPC
|
||||||
BlockChainFactories["Unobtanium"] = unobtanium.NewUnobtaniumRPC
|
BlockChainFactories["Unobtanium"] = unobtanium.NewUnobtaniumRPC
|
||||||
BlockChainFactories["DeepOnion"] = deeponion.NewDeepOnionRPC
|
BlockChainFactories["DeepOnion"] = deeponion.NewDeepOnionRPC
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCoinNameFromConfig gets coin name and coin shortcut from config file
|
// GetCoinNameFromConfig gets coin name and coin shortcut from config file
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package deeponion
|
package deeponion
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"blockbook/bchain"
|
"blockbook/bchain"
|
||||||
"blockbook/bchain/coins/btc"
|
"blockbook/bchain/coins/btc"
|
||||||
|
|
||||||
"github.com/martinboehm/btcd/wire"
|
"github.com/martinboehm/btcd/wire"
|
||||||
@ -35,8 +35,8 @@ type DeepOnionParser struct {
|
|||||||
// NewDeepOnionParser returns new DeepOnionParser instance
|
// NewDeepOnionParser returns new DeepOnionParser instance
|
||||||
func NewDeepOnionParser(params *chaincfg.Params, c *btc.Configuration) *DeepOnionParser {
|
func NewDeepOnionParser(params *chaincfg.Params, c *btc.Configuration) *DeepOnionParser {
|
||||||
return &DeepOnionParser{
|
return &DeepOnionParser{
|
||||||
BitcoinParser: btc.NewBitcoinParser(params, c),
|
BitcoinParser: btc.NewBitcoinParser(params, c),
|
||||||
baseparser: &bchain.BaseParser{},
|
baseparser: &bchain.BaseParser{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,6 @@ func TestMain(m *testing.M) {
|
|||||||
os.Exit(c)
|
os.Exit(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func Test_GetAddrDescFromAddress_Mainnet(t *testing.T) {
|
func Test_GetAddrDescFromAddress_Mainnet(t *testing.T) {
|
||||||
type args struct {
|
type args struct {
|
||||||
address string
|
address string
|
||||||
@ -191,7 +190,7 @@ func Test_UnpackTx(t *testing.T) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(got, tt.want) {
|
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 {
|
if got1 != tt.want1 {
|
||||||
t.Errorf("unpackTx(3) got1 = %v, want %v", got1, tt.want1)
|
t.Errorf("unpackTx(3) got1 = %v, want %v", got1, tt.want1)
|
||||||
|
|||||||
@ -60,50 +60,50 @@ func (b *DeepOnionRPC) Initialize() error {
|
|||||||
|
|
||||||
// GetBlock returns block with given hash.
|
// GetBlock returns block with given hash.
|
||||||
func (s *DeepOnionRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) {
|
func (s *DeepOnionRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) {
|
||||||
var err error
|
var err error
|
||||||
if hash == "" && height > 0 {
|
if hash == "" && height > 0 {
|
||||||
hash, err = s.GetBlockHash(height)
|
hash, err = s.GetBlockHash(height)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Info("rpc: getblock (verbosity=1) ", hash)
|
glog.V(1).Info("rpc: getblock (verbosity=1) ", hash)
|
||||||
|
|
||||||
res := btc.ResGetBlockThin{}
|
res := btc.ResGetBlockThin{}
|
||||||
req := btc.CmdGetBlock{Method: "getblock"}
|
req := btc.CmdGetBlock{Method: "getblock"}
|
||||||
req.Params.BlockHash = hash
|
req.Params.BlockHash = hash
|
||||||
req.Params.Verbosity = 1
|
req.Params.Verbosity = 1
|
||||||
err = s.Call(&req, &res)
|
err = s.Call(&req, &res)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Annotatef(err, "hash %v", hash)
|
return nil, errors.Annotatef(err, "hash %v", hash)
|
||||||
}
|
}
|
||||||
if res.Error != nil {
|
if res.Error != nil {
|
||||||
return nil, errors.Annotatef(res.Error, "hash %v", hash)
|
return nil, errors.Annotatef(res.Error, "hash %v", hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
txs := make([]bchain.Tx, 0, len(res.Result.Txids))
|
txs := make([]bchain.Tx, 0, len(res.Result.Txids))
|
||||||
for _, txid := range res.Result.Txids {
|
for _, txid := range res.Result.Txids {
|
||||||
tx, err := s.GetTransaction(txid)
|
tx, err := s.GetTransaction(txid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == bchain.ErrTxNotFound {
|
if err == bchain.ErrTxNotFound {
|
||||||
glog.Errorf("rpc: getblock: skipping transanction in block %s due error: %s", hash, err)
|
glog.Errorf("rpc: getblock: skipping transanction in block %s due error: %s", hash, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
txs = append(txs, *tx)
|
txs = append(txs, *tx)
|
||||||
}
|
}
|
||||||
block := &bchain.Block{
|
block := &bchain.Block{
|
||||||
BlockHeader: res.Result.BlockHeader,
|
BlockHeader: res.Result.BlockHeader,
|
||||||
Txs: txs,
|
Txs: txs,
|
||||||
}
|
}
|
||||||
return block, nil
|
return block, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTransactionForMempool returns a transaction by the transaction ID.
|
// GetTransactionForMempool returns a transaction by the transaction ID.
|
||||||
// It could be optimized for mempool, i.e. without block time and confirmations
|
// It could be optimized for mempool, i.e. without block time and confirmations
|
||||||
func (s *DeepOnionRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error) {
|
func (s *DeepOnionRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error) {
|
||||||
return s.GetTransaction(txid)
|
return s.GetTransaction(txid)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user