aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-04-16 16:20:01 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-04-16 16:20:01 +0800
commitee6531c5ff712307325e8866b73397179f4bb8cd (patch)
tree5a3d44c18fbf4eb1955d866ba4742aa8cc535d58
parent6ceb253f743ec0d2bdd9a676c7f365de2201470c (diff)
downloadgo-tangerine-ee6531c5ff712307325e8866b73397179f4bb8cd.tar.gz
go-tangerine-ee6531c5ff712307325e8866b73397179f4bb8cd.tar.zst
go-tangerine-ee6531c5ff712307325e8866b73397179f4bb8cd.zip
whisper: remove dead code, rename a few constants
-rw-r--r--whisper/peer.go4
-rw-r--r--whisper/peer_test.go2
-rw-r--r--whisper/sort.go29
-rw-r--r--whisper/sort_test.go23
-rw-r--r--whisper/whisper.go6
-rw-r--r--whisper/whisper_test.go2
6 files changed, 7 insertions, 59 deletions
diff --git a/whisper/peer.go b/whisper/peer.go
index 8bf848855..e4301f37c 100644
--- a/whisper/peer.go
+++ b/whisper/peer.go
@@ -88,8 +88,8 @@ func (self *peer) handshake() error {
// and expiration.
func (self *peer) update() {
// Start the tickers for the updates
- expire := time.NewTicker(expirationTicks)
- transmit := time.NewTicker(transmissionTicks)
+ expire := time.NewTicker(expirationCycle)
+ transmit := time.NewTicker(transmissionCycle)
// Loop and transmit until termination is requested
for {
diff --git a/whisper/peer_test.go b/whisper/peer_test.go
index 53aff7c55..de67b2463 100644
--- a/whisper/peer_test.go
+++ b/whisper/peer_test.go
@@ -185,7 +185,7 @@ func TestPeerDeliver(t *testing.T) {
t.Fatalf("failed to transfer message: %v", err)
}
select {
- case <-time.After(2 * transmissionTicks):
+ case <-time.After(2 * transmissionCycle):
case <-arrived:
t.Fatalf("repeating message arrived")
}
diff --git a/whisper/sort.go b/whisper/sort.go
deleted file mode 100644
index 313ba5ac0..000000000
--- a/whisper/sort.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package whisper
-
-import (
- "sort"
-
- "github.com/ethereum/go-ethereum/common"
-)
-
-type sortedKeys struct {
- k []int32
-}
-
-func (self *sortedKeys) Len() int { return len(self.k) }
-func (self *sortedKeys) Less(i, j int) bool { return self.k[i] < self.k[j] }
-func (self *sortedKeys) Swap(i, j int) { self.k[i], self.k[j] = self.k[j], self.k[i] }
-
-func sortKeys(m map[int32]common.Hash) []int32 {
- sorted := new(sortedKeys)
- sorted.k = make([]int32, len(m))
- i := 0
- for key, _ := range m {
- sorted.k[i] = key
- i++
- }
-
- sort.Sort(sorted)
-
- return sorted.k
-}
diff --git a/whisper/sort_test.go b/whisper/sort_test.go
deleted file mode 100644
index a61fde4c2..000000000
--- a/whisper/sort_test.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package whisper
-
-import (
- "testing"
-
- "github.com/ethereum/go-ethereum/common"
-)
-
-func TestSorting(t *testing.T) {
- m := map[int32]common.Hash{
- 1: {1},
- 3: {3},
- 2: {2},
- 5: {5},
- }
- exp := []int32{1, 2, 3, 5}
- res := sortKeys(m)
- for i, k := range res {
- if k != exp[i] {
- t.Error(k, "failed. Expected", exp[i])
- }
- }
-}
diff --git a/whisper/whisper.go b/whisper/whisper.go
index b83e3f1c6..f04075e1f 100644
--- a/whisper/whisper.go
+++ b/whisper/whisper.go
@@ -25,8 +25,8 @@ const (
signatureFlag = byte(1 << 7)
signatureLength = 65
- expirationTicks = 800 * time.Millisecond
- transmissionTicks = 300 * time.Millisecond
+ expirationCycle = 800 * time.Millisecond
+ transmissionCycle = 300 * time.Millisecond
)
const (
@@ -275,7 +275,7 @@ func createFilter(message *Message, topics []Topic) filter.Filter {
// state by expiring stale messages from the pool.
func (self *Whisper) update() {
// Start a ticker to check for expirations
- expire := time.NewTicker(expirationTicks)
+ expire := time.NewTicker(expirationCycle)
// Repeat updates until termination is requested
for {
diff --git a/whisper/whisper_test.go b/whisper/whisper_test.go
index 554a12cb1..def8e68d8 100644
--- a/whisper/whisper_test.go
+++ b/whisper/whisper_test.go
@@ -178,7 +178,7 @@ func TestMessageExpiration(t *testing.T) {
}
// Wait for expiration and check cache again
time.Sleep(time.Second) // wait for expiration
- time.Sleep(expirationTicks) // wait for cleanup cycle
+ time.Sleep(expirationCycle) // wait for cleanup cycle
if _, ok := node.messages[envelope.Hash()]; ok {
t.Fatalf("message not expired from cache")
}
td class='commitgraph'>| * | Fill SAR testsYoichi Hirai2018-03-2316-0/+10492 * | | Fill SHR testsYoichi Hirai2018-03-2211-0/+7211 |/ / * | Merge pull request #421 from ethereum/more-shiftswinsvega2018-03-1711-36/+6592 |\ \ | * | Add more shl testsYoichi Hirai2018-03-1011-36/+6592 | |/ * / Fill identity_to_bigger testYoichi Hirai2018-03-141-0/+218 |/ * Merge pull request #419 from ethereum/init-create-revertYoichi Hirai2018-03-011-0/+548 |\ | * revert in CREATE in init code, followed by returndatasize/copyYoichi Hirai2018-02-271-0/+548 * | Add (shl 0 1) testYoichi Hirai2018-03-011-0/+656 * | Add directories for tests for shift instructionsYoichi Hirai2018-02-271-0/+1 |/ * fix syntax in testsDimitry2018-02-178-48/+48 * fix stCreateTestDimitry2018-02-1747-742/+7657 * fix stRevertTestDimitry2018-02-17133-2586/+11986 * fix stStaticCallDimitry2018-02-17495-3073/+14862 * fix stZeroKnowledge2Dimitry2018-02-17520-1078/+138821 * fix stZeroKnowledgeDimitry2018-02-16804-2252/+189265 * fix stBugsDimitry2018-02-167-71/+1859 * fix stMemoryStressTestDimitry2018-02-1682-606/+4125 * fix stQuadraticComplexityTestDimitry2018-02-1632-224/+3658 * fix stArgsZeroOneBalanceDimitry2018-02-1696-560/+2291 * fix stBadOpcodesDimitry2018-02-16122-2542/+2842 * fix stPreCompiledContracts2Dimitry2018-02-16112-2742/+5745 * fix stPreCompiledContracts empty expectDimitry2018-02-16517-1566/+98178 * update stSolidityTestDimitry2018-02-0716-138/+1578 * update bcForgedTestsDimitry2018-02-073-286/+286 * refill stZeroCallsRevertDimitry2018-02-0724-10976/+208 * refill stZeroKnowledge2Dimitry2018-02-07520-873383/+1040 * refill stZeroKnowledgeDimitry2018-02-07804-1003643/+2408 * refill and update stSpecialTest, stStackTest, stZeroCallsDimitry2018-02-07219-90935/+2011 * refill stRecursiveDimitry2018-02-072-8563/+72 * refill stQuadraticComplexityDimitry2018-02-0732-35032/+14490 * update stPreCompiledContracts, stEIP158Specific, stQuadraticComplexityDimitry2018-02-07528-468040/+1956 * update stCodeSize stBadOpcodeDimitry2018-02-074-417/+121 * refill stBugsDimitry2018-02-067-4396/+478 * refill stAttack stBadOpcodeDimitry2018-02-06124-37348/+2989 * refill stArgsZeroOneBalanceDimitry2018-02-06108-60726/+904 * refill blockchain stZeroCallsTestDimitry2018-02-0624-1060/+1060 * refill blockchain stWalletTestDimitry2018-02-0645-17730/+610 * refill blockchain stTransitionTestDimitry2018-02-069-375/+375 * refill blockchain stTransactionDimitry2018-02-06174-21526/+5994 * refill blockchain stSystemOperationsDimitry2018-02-0566-3512/+2905 * refill blockchain stStaticCallDimitry2018-02-05495-330828/+3707 * refill blockchain stSolidityTestDimitry2018-02-0516-6373/+200 * refill blockchain stRevertTestDimitry2018-02-05133-55793/+3123 * refill blockchain stReturnDataTestDimitry2018-02-0544-6143/+1693 * refill blockchain stRefundTestDimitry2018-02-0524-3841/+825 * refill blockchain stMemoryTestDimitry2018-02-0567-3254/+3010 * refill blockchain stRandom2Dimitry2018-02-03227-81971/+3635 * refill stRandomDimitry2018-02-02327-117795/+5232 * update stPreCompiledContracts2Dimitry2018-02-02112-24509/+4096 * update stNonZeroCallsTestDimitry2018-02-0224-1060/+1060 * refill stMemoryStressTestDimitry2018-02-0282-38410/+904 * refill stMemExpandingEUP150CallsDimitry2018-02-028-472/+351 * refill stLogTestsDimitry2018-02-0146-2070/+2070 * refill stInitCodeTestDimitry2018-02-0118-730/+730 * update stInitCode test fillersDimitry2018-02-011-45/+45 * refill stEIP150Specific testsDimitry2018-02-0113-5002/+243 * refill blockchain stEIP150singleCodeGasPricesDimitry2018-02-0130-7939/+819 * refill blockchain stDelegatecallTestHomesteadDimitry2018-02-0140-14227/+750 * refill blockchain stCreateTestDimitry2018-02-0147-15961/+1740 * refill blockchain stChangedEIP150 testsDimitry2018-02-0131-9175/+865 * refill blockchain stCallDelegateCodesHomesteadDimitry2018-01-3158-24251/+1188 * refill blockchain stCallDelegateCodesCallCodeHomesteadDimitry2018-01-3158-24657/+1161 * refill blockchain stCallCreateCallCodeDimitry2018-01-3140-14530/+718 * refill blockchain stCallCodesDimitry2018-01-3180-34780/+1508 * fix travis tests for PR 4809Dimitry2018-01-301-82/+82 * Add a new input for modlen = 999188.Yoichi Hirai2018-01-305-274/+928 * stArgsZeroOneBalance testsDimitry2018-01-16109-0/+70863 * add filler for codeCopyOffset, change locationJared Wasinger2018-01-041-0/+734 * refill callDataCopyOffset testDimitry2017-12-301-42/+42 * Merge pull request #384 from ethereum/revert_in_delegate_call_moreYoichi Hirai2017-12-211-102/+227 |\ | * Test RETURNDATASIZE and RETURNDATACOPY in RevertInDelegateCallFillerYoichi Hirai2017-12-141-102/+227 * | Merge pull request #372 from ethereum/modexp-returndatasizewinsvega2017-12-202-0/+1316 |\ \ | * | add more modexp returndatasize test casesJared Wasinger2017-11-252-0/+1316 * | | add test for CALLDATACOPY where calldata offset > calldata length and copy le...Jared Wasinger2017-12-151-0/+734 | |/ |/| * | Merge pull request #375 from ethereum/returndatacopy_following_revert_in_createwinsvega2017-12-131-0/+656 |\ \ | * | Adding a new test about returndatacopy following a revert in an init codeYoichi Hirai2017-12-061-0/+656 | |/ * | Merge pull request #379 from ethereum/returndatacopy_after_revert_in_staticYoichi Hirai2017-12-081-0/+740 |\ \ | * | Add a test case for RETURNDATACOPY after REVERT in STATICCALLYoichi Hirai2017-12-081-0/+740 | |/ * / Store the result of RETURNDATASIZE after a static call fails for a REVERTYoichi Hirai2017-12-082-166/+410 |/ * fix StaticCallTestsDimitry2017-11-232-191/+414 * Add a test for checking RETURNDATASIZE after a modexp with modsize = 1Yoichi Hirai2017-10-252-36/+694 * create failing inside staticcallDimitry2017-10-252-0/+1644 * returndatacopy bugDimitry2017-10-244-0/+3584 * Merge pull request #363 from ethereum/modexp-modsize0-returnsizeYoichi Hirai2017-10-244-0/+2624 |\ | * Add tests about returndatasize following modexp calls of modsize = 0Yoichi Hirai2017-10-234-0/+2624 * | Merge pull request #362 from ethereum/returndata-ecrecYoichi Hirai2017-10-241-0/+644 |\ \ | * | add casey's testDimitry2017-10-191-0/+644 * | | Merge pull request #361 from ethereum/returntestYoichi Hirai2017-10-241-0/+658 |\ \ \ | |_|/ |/| | | * | RETURNDATACOPY and RETURNDATASIZE after failing createDimitry2017-10-191-0/+658 * | | Add a test case about transaction calls A (CALL B(CALL C(RETURN) OOG) 'check ...Yoichi Hirai2017-10-181-0/+842 * | | RETURNDATASIZE after a failing CALL (due to insufficient balance) should retu...Dimitry2017-10-171-0/+738 |/ / * | fix random state testDimitry2017-10-171-36/+36 * | Merge pull request #354 from ethereum/modexpinputYoichi Hirai2017-10-136-0/+3486 |\ \ | * | modexp input testDimitry2017-10-136-266/+1428 | * | fuzzed test modexp inputDimitry2017-10-134-0/+2324 * | | Merge pull request #352 from ethereum/badOpcodes-bigger-stackwinsvega2017-10-13122-7620/+18973 |\ \ \ | * | | refill badopcodes blockchain tests, blockchain general state testsJared Wasinger2017-10-13122-7620/+18973 * | | | fuzztests bytecodeDimitry2017-10-131-0/+644 | |/ / |/| | * | | split random testsDimitry2017-10-13227-130322/+25 * | | split large test suitesDimitry2017-10-13