From 58876150c3497a40e40cbff398a5b9b90f4be986 Mon Sep 17 00:00:00 2001 From: Jakub Matys Date: Tue, 22 May 2018 12:30:09 +0200 Subject: [PATCH] Removed unused code --- bchain/coins/bch/bcashrpc.go | 41 ---------------------------------- bchain/coins/btc/bitcoinrpc.go | 36 ----------------------------- 2 files changed, 77 deletions(-) diff --git a/bchain/coins/bch/bcashrpc.go b/bchain/coins/bch/bcashrpc.go index 8ccbe993..3bfb70c6 100644 --- a/bchain/coins/bch/bcashrpc.go +++ b/bchain/coins/bch/bcashrpc.go @@ -103,11 +103,6 @@ func (b *BCashRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) { return nil, err } } - // XXX - // // optimization - // if height > 0 { - // return b.getBlockWithoutHeader(hash, height) - // } header, err := b.GetBlockHeader(hash) if err != nil { return nil, err @@ -146,42 +141,6 @@ func (b *BCashRPC) GetBlockRaw(hash string) ([]byte, error) { return hex.DecodeString(res.Result) } -// GetBlockList returns block with given hash by downloading block -// transactions one by one. -func (b *BCashRPC) GetBlockList(hash string) (*bchain.Block, error) { - glog.V(1).Info("rpc: getblock (verbose=1) ", hash) - - res := resGetBlockThin{} - req := cmdGetBlock{Method: "getblock"} - req.Params.BlockHash = hash - req.Params.Verbose = true - err := b.Call(&req, &res) - - if err != nil { - return nil, errors.Annotatef(err, "hash %v", hash) - } - if res.Error != nil { - if isErrBlockNotFound(res.Error) { - return nil, bchain.ErrBlockNotFound - } - return nil, errors.Annotatef(res.Error, "hash %v", hash) - } - - txs := make([]bchain.Tx, len(res.Result.Txids)) - for i, txid := range res.Result.Txids { - tx, err := b.GetTransaction(txid) - if err != nil { - return nil, err - } - txs[i] = *tx - } - block := &bchain.Block{ - BlockHeader: res.Result.BlockHeader, - Txs: txs, - } - return block, nil -} - // GetBlockFull returns block with given hash. func (b *BCashRPC) GetBlockFull(hash string) (*bchain.Block, error) { return nil, errors.New("Not implemented") diff --git a/bchain/coins/btc/bitcoinrpc.go b/bchain/coins/btc/bitcoinrpc.go index 75617c95..d7c9b756 100644 --- a/bchain/coins/btc/bitcoinrpc.go +++ b/bchain/coins/btc/bitcoinrpc.go @@ -492,42 +492,6 @@ func (b *BitcoinRPC) GetBlockRaw(hash string) ([]byte, error) { return hex.DecodeString(res.Result) } -// GetBlockList returns block with given hash by downloading block -// transactions one by one. -func (b *BitcoinRPC) GetBlockList(hash string) (*bchain.Block, error) { - glog.V(1).Info("rpc: getblock (verbosity=1) ", hash) - - res := resGetBlockThin{} - req := cmdGetBlock{Method: "getblock"} - req.Params.BlockHash = hash - req.Params.Verbosity = 1 - err := b.Call(&req, &res) - - if err != nil { - return nil, errors.Annotatef(err, "hash %v", hash) - } - if res.Error != nil { - if isErrBlockNotFound(res.Error) { - return nil, bchain.ErrBlockNotFound - } - return nil, errors.Annotatef(res.Error, "hash %v", hash) - } - - txs := make([]bchain.Tx, len(res.Result.Txids)) - for i, txid := range res.Result.Txids { - tx, err := b.GetTransaction(txid) - if err != nil { - return nil, err - } - txs[i] = *tx - } - block := &bchain.Block{ - BlockHeader: res.Result.BlockHeader, - Txs: txs, - } - return block, nil -} - // GetBlockFull returns block with given hash. func (b *BitcoinRPC) GetBlockFull(hash string) (*bchain.Block, error) { glog.V(1).Info("rpc: getblock (verbosity=2) ", hash)