From bf7b94e832a24a90aa84cf0bd8d085ab7ca5cfe7 Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Mon, 10 Sep 2018 18:49:38 -0700 Subject: [PATCH] clean up --- blockchain/blockchain.go | 10 ---------- blockchain/transaction.go | 5 +++-- p2p/helper_test.go | 21 --------------------- 3 files changed, 3 insertions(+), 33 deletions(-) diff --git a/blockchain/blockchain.go b/blockchain/blockchain.go index a549a42d2..5faf28c74 100644 --- a/blockchain/blockchain.go +++ b/blockchain/blockchain.go @@ -205,16 +205,6 @@ func CreateBlockchain(address [20]byte, shardId uint32) *Blockchain { return &bc } -// Creat testing genesis block. -func CreateTestingGenesisBlock() *Block { - priIntOne := 111 - shardId := uint32(1) - testAddressOne := pki.GetAddressFromInt(priIntOne) - cbtx := NewCoinbaseTX(testAddressOne, genesisCoinbaseData, shardId) - genesis := NewGenesisBlock(cbtx, shardId) - return genesis -} - // Create state block based on the utxos. func (bc *Blockchain) CreateStateBlock(utxoPool *UTXOPool) *Block { var numBlocks int32 = 0 diff --git a/blockchain/transaction.go b/blockchain/transaction.go index 2d252c5b1..b25a618a4 100644 --- a/blockchain/transaction.go +++ b/blockchain/transaction.go @@ -7,11 +7,12 @@ import ( "encoding/gob" "encoding/hex" "fmt" + "log" + "math" + "github.com/dedis/kyber" "github.com/dedis/kyber/sign/schnorr" "github.com/simple-rules/harmony-benchmark/crypto" - "log" - "math" ) var ( diff --git a/p2p/helper_test.go b/p2p/helper_test.go index 4f919549e..ab4a3b4f8 100644 --- a/p2p/helper_test.go +++ b/p2p/helper_test.go @@ -2,13 +2,9 @@ package p2p_test import ( "bufio" - "bytes" - "encoding/gob" "net" - "reflect" "testing" - "github.com/simple-rules/harmony-benchmark/blockchain" "github.com/simple-rules/harmony-benchmark/p2p" ) @@ -57,20 +53,3 @@ func TestNewNewNode(t *testing.T) { } } } - -func TestGobEncode(t *testing.T) { - block := blockchain.CreateTestingGenesisBlock() - - var tmp bytes.Buffer - enc := gob.NewEncoder(&tmp) - enc.Encode(*block) - - tmp2 := bytes.NewBuffer(tmp.Bytes()) - dec := gob.NewDecoder(tmp2) - - var block2 blockchain.Block - dec.Decode(&block2) - if !reflect.DeepEqual(*block, block2) { - t.Error("Error in GobEncode") - } -}