diff options
author | Felföldi Zsolt <zsfelfoldi@gmail.com> | 2017-08-09 00:31:08 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-08-09 00:31:08 +0800 |
commit | fff6e03a792b0e0a84943e2c3764c39b2840458a (patch) | |
tree | 37d811da67038ac2bacdf1b1595a8f867b46eba0 /les/helper_test.go | |
parent | d375193797e8198a82c6a1796064ffb289c6956e (diff) | |
download | dexon-fff6e03a792b0e0a84943e2c3764c39b2840458a.tar.gz dexon-fff6e03a792b0e0a84943e2c3764c39b2840458a.tar.zst dexon-fff6e03a792b0e0a84943e2c3764c39b2840458a.zip |
les: fix megacheck warnings (#14941)
* les: fix megacheck warnings
* les: fixed testGetProofs
Diffstat (limited to 'les/helper_test.go')
-rw-r--r-- | les/helper_test.go | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/les/helper_test.go b/les/helper_test.go index 52fddd117..7dccfc458 100644 --- a/les/helper_test.go +++ b/les/helper_test.go @@ -20,7 +20,6 @@ package les import ( - "crypto/ecdsa" "crypto/rand" "math/big" "sync" @@ -140,7 +139,7 @@ func newTestProtocolManager(lightSync bool, blocks int, generator func(int, *cor Alloc: core.GenesisAlloc{testBankAddress: {Balance: testBankFunds}}, } genesis = gspec.MustCommit(db) - chain BlockChain + chain BlockChain ) if peers == nil { peers = newPeerSet() @@ -189,45 +188,6 @@ func newTestProtocolManagerMust(t *testing.T, lightSync bool, blocks int, genera return pm } -// testTxPool is a fake, helper transaction pool for testing purposes -type testTxPool struct { - pool []*types.Transaction // Collection of all transactions - added chan<- []*types.Transaction // Notification channel for new transactions - - lock sync.RWMutex // Protects the transaction pool -} - -// AddTransactions appends a batch of transactions to the pool, and notifies any -// listeners if the addition channel is non nil -func (p *testTxPool) AddBatch(txs []*types.Transaction) { - p.lock.Lock() - defer p.lock.Unlock() - - p.pool = append(p.pool, txs...) - if p.added != nil { - p.added <- txs - } -} - -// GetTransactions returns all the transactions known to the pool -func (p *testTxPool) GetTransactions() types.Transactions { - p.lock.RLock() - defer p.lock.RUnlock() - - txs := make([]*types.Transaction, len(p.pool)) - copy(txs, p.pool) - - return txs -} - -// newTestTransaction create a new dummy transaction. -func newTestTransaction(from *ecdsa.PrivateKey, nonce uint64, datasize int) *types.Transaction { - tx := types.NewTransaction(nonce, common.Address{}, big.NewInt(0), big.NewInt(100000), big.NewInt(0), make([]byte, datasize)) - tx, _ = types.SignTx(tx, types.HomesteadSigner{}, from) - - return tx -} - // testPeer is a simulated peer to allow testing direct network calls. type testPeer struct { net p2p.MsgReadWriter // Network layer reader/writer to simulate remote messaging |