Commit 588bf141 authored by Nao Nishijima's avatar Nao Nishijima
Browse files

[FAB-3707] Delete unused vars, etc in orderer dir



This patchset deletes unused vars etc in orderer directory.
Since the test was commented out, there are some variables that
became unused variables. So this patchset deletes the test.

Change-Id: I11986a3e2ac8083788d7b85b04b6b9a48ac26722
Signed-off-by: default avatarNao Nishijima <Nao.nishijima@hal.hitachi.com>
parent 5c353eb1
......@@ -21,7 +21,6 @@ import (
"time"
"github.com/Shopify/sarama"
genesisconfig "github.com/hyperledger/fabric/common/configtx/tool/localconfig"
"github.com/hyperledger/fabric/orderer/localconfig"
cb "github.com/hyperledger/fabric/protos/common"
)
......@@ -38,14 +37,6 @@ var (
testTimePadding = 200 * time.Millisecond
)
var testGenesisConf = &genesisconfig.TopLevel{
Orderer: &genesisconfig.Orderer{
Kafka: genesisconfig.Kafka{
Brokers: []string{"127.0.0.1:9092"},
},
},
}
var testConf = &config.TopLevel{
Kafka: config.Kafka{
Retry: config.Retry{
......
......@@ -36,14 +36,9 @@ import (
var cp = newChainPartition(provisional.TestChainID, rawPartition)
func newMockSharedConfigManager() *mockconfig.Orderer {
return &mockconfig.Orderer{KafkaBrokersVal: testGenesisConf.Orderer.Kafka.Brokers}
}
type mockConsenterImpl struct {
consenterImpl
prodDisk, consDisk chan *ab.KafkaMessage
consumerSetUp bool
t *testing.T
}
......
......@@ -49,12 +49,11 @@ type cursor struct {
}
type jsonLedger struct {
directory string
fqFormatString string
height uint64
signal chan struct{}
lastHash []byte
marshaler *jsonpb.Marshaler
directory string
height uint64
signal chan struct{}
lastHash []byte
marshaler *jsonpb.Marshaler
}
// readBlock returns the block or nil, and whether the block was found or not, (nil,true) generally indicates an irrecoverable problem
......
......@@ -33,8 +33,6 @@ import (
ab "github.com/hyperledger/fabric/protos/orderer"
"github.com/hyperledger/fabric/protos/utils"
"errors"
mmsp "github.com/hyperledger/fabric/common/mocks/msp"
logging "github.com/op/go-logging"
"github.com/stretchr/testify/assert"
......@@ -63,18 +61,6 @@ func (mch mockCryptoHelper) VerifySignature(sd *cb.SignedData) error {
return nil
}
func mockCryptoRejector() *mockCryptoRejectorHelper {
return &mockCryptoRejectorHelper{LocalSigner: mockcrypto.FakeLocalSigner}
}
type mockCryptoRejectorHelper struct {
*mockcrypto.LocalSigner
}
func (mch mockCryptoRejectorHelper) VerifySignature(sd *cb.SignedData) error {
return errors.New("Nope")
}
func NewRAMLedgerAndFactory(maxSize int) (ledger.Factory, ledger.ReadWriter) {
rlf := ramledger.New(10)
rl, err := rlf.GetOrCreate(provisional.TestChainID)
......@@ -213,45 +199,6 @@ func TestManagerImpl(t *testing.T) {
}
}
/*
// This test makes sure that the signature filter works
func TestSignatureFilter(t *testing.T) {
lf, rl := NewRAMLedgerAndFactory(10)
consenters := make(map[string]Consenter)
consenters[conf.Orderer.OrdererType] = &mockConsenter{}
manager := NewManagerImpl(lf, consenters, mockCryptoRejector())
cs, ok := manager.GetChain(provisional.TestChainID)
if !ok {
t.Fatalf("Should have gotten chain which was initialized by ramledger")
}
messages := make([]*cb.Envelope, conf.Orderer.BatchSize.MaxMessageCount)
for i := 0; i < int(conf.Orderer.BatchSize.MaxMessageCount); i++ {
messages[i] = makeSignaturelessTx(provisional.TestChainID, i)
}
for _, message := range messages {
cs.Enqueue(message)
}
// Causes the consenter thread to exit after it processes all messages
close(cs.(*chainSupport).chain.(*mockChain).queue)
it, _ := rl.Iterator(&ab.SeekPosition{Type: &ab.SeekPosition_Specified{Specified: &ab.SeekSpecified{Number: 1}}})
select {
case <-it.ReadyChan():
// Will unblock if a block is created
t.Fatalf("Block 1 should not have been created")
case <-cs.(*chainSupport).chain.(*mockChain).done:
// Will unblock once the consenter thread has exited
}
}
*/
// This test brings up the entire system, with the mock consenter, including the broadcasters etc. and creates a new chain
func TestNewChain(t *testing.T) {
expectedLastConfigBlockNumber := uint64(0)
......
......@@ -74,14 +74,6 @@ func (mch *mockChain) Halt() {
close(mch.queue)
}
type mockLedgerWriter struct {
}
func (mlw *mockLedgerWriter) Append(blockContents []*cb.Envelope, metadata [][]byte) *cb.Block {
logger.Debugf("Committed block")
return nil
}
func makeConfigTx(chainID string, i int) *cb.Envelope {
group := cb.NewConfigGroup()
group.Groups[config.OrdererGroupKey] = cb.NewConfigGroup()
......@@ -134,18 +126,3 @@ func makeNormalTx(chainID string, i int) *cb.Envelope {
Payload: utils.MarshalOrPanic(payload),
}
}
func makeSignaturelessTx(chainID string, i int) *cb.Envelope {
payload := &cb.Payload{
Header: &cb.Header{
ChannelHeader: utils.MarshalOrPanic(&cb.ChannelHeader{
Type: int32(cb.HeaderType_ENDORSER_TRANSACTION),
ChannelId: chainID,
}),
},
Data: []byte(fmt.Sprintf("%d", i)),
}
return &cb.Envelope{
Payload: utils.MarshalOrPanic(payload),
}
}
......@@ -52,21 +52,8 @@ const maindir = "github.com/hyperledger/fabric/orderer"
var ordererDir string
var mainexe string
type flags struct {
listenAddr string
grpcAddr string
telemetryAddr string
certFile string
keyFile string
dataDir string
genesisFile string
verbose string
init string
}
type Peer struct {
id uint64
config flags
cancel context.CancelFunc
cmd *exec.Cmd
}
......
......@@ -63,17 +63,6 @@ func (s *SBFT) cutAndMaybeSend() {
s.maybeSendNextBatch()
}
func (s *SBFT) batchSize() uint64 {
size := uint64(0)
if len(s.batches) == 0 {
return size
}
for _, req := range s.batches[0] {
size += uint64(len(req.Payload))
}
return size
}
func (s *SBFT) maybeSendNextBatch() {
if s.batchTimer != nil {
s.batchTimer.Cancel()
......
......@@ -299,10 +299,6 @@ func newTestSystemWithBatchSize(n uint64, batchSize uint64) *testSystem {
return newTestSystemWithParams(n, batchSize, false)
}
func newTestSystemWOTimers(n uint64) *testSystem {
return newTestSystemWithParams(n, defaultMaxReqCount, true)
}
func newTestSystemWOTimersWithBatchSize(n uint64, batchSize uint64) *testSystem {
return newTestSystemWithParams(n, batchSize, true)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment