diff options
author | zelig <viktor.tron@gmail.com> | 2015-02-25 20:34:12 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-02-25 20:34:12 +0800 |
commit | 422490d75cf9a2406430f2d7c0d7dd77ede18f7c (patch) | |
tree | 63860f0914370bec71cac6f1708476da4f7533cc /blockpool/config_test.go | |
parent | d46c7bcaf9268a191f0156d36abf394df5374795 (diff) | |
download | go-tangerine-422490d75cf9a2406430f2d7c0d7dd77ede18f7c.tar.gz go-tangerine-422490d75cf9a2406430f2d7c0d7dd77ede18f7c.tar.zst go-tangerine-422490d75cf9a2406430f2d7c0d7dd77ede18f7c.zip |
major rewrite, reorg of blockpool + new features
- blockpool moves to its own package
- uses errs pkg for its own coded errors
- publicly settable config of params (time intervals and batchsizes)
- test helpers in subpackage
- optional TD in blocks used now to update peers chain info
- major improvement in algorithm
- fix fragility and sync/parallelisation bugs
- implement status for reporting on sync status (peers/hashes/blocks etc)
- several tests added and further corner cases covered
Diffstat (limited to 'blockpool/config_test.go')
-rw-r--r-- | blockpool/config_test.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/blockpool/config_test.go b/blockpool/config_test.go new file mode 100644 index 000000000..c06649024 --- /dev/null +++ b/blockpool/config_test.go @@ -0,0 +1,40 @@ +package blockpool + +import ( + "testing" + "time" + + "github.com/ethereum/go-ethereum/blockpool/test" +) + +func TestBlockPoolConfig(t *testing.T) { + test.LogInit() + blockPool := &BlockPool{Config: &Config{}} + blockPool.Start() + c := blockPool.Config + test.CheckInt("BlockHashesBatchSize", c.BlockHashesBatchSize, blockHashesBatchSize, t) + test.CheckInt("BlockBatchSize", c.BlockBatchSize, blockBatchSize, t) + test.CheckInt("BlocksRequestRepetition", c.BlocksRequestRepetition, blocksRequestRepetition, t) + test.CheckInt("BlocksRequestMaxIdleRounds", c.BlocksRequestMaxIdleRounds, blocksRequestMaxIdleRounds, t) + test.CheckDuration("BlockHashesRequestInterval", c.BlockHashesRequestInterval, blockHashesRequestInterval, t) + test.CheckDuration("BlocksRequestInterval", c.BlocksRequestInterval, blocksRequestInterval, t) + test.CheckDuration("BlockHashesTimeout", c.BlockHashesTimeout, blockHashesTimeout, t) + test.CheckDuration("BlocksTimeout", c.BlocksTimeout, blocksTimeout, t) +} + +func TestBlockPoolOverrideConfig(t *testing.T) { + test.LogInit() + blockPool := &BlockPool{Config: &Config{}} + c := &Config{128, 32, 1, 0, 300 * time.Millisecond, 100 * time.Millisecond, 90 * time.Second, 0} + + blockPool.Config = c + blockPool.Start() + test.CheckInt("BlockHashesBatchSize", c.BlockHashesBatchSize, 128, t) + test.CheckInt("BlockBatchSize", c.BlockBatchSize, 32, t) + test.CheckInt("BlocksRequestRepetition", c.BlocksRequestRepetition, blocksRequestRepetition, t) + test.CheckInt("BlocksRequestMaxIdleRounds", c.BlocksRequestMaxIdleRounds, blocksRequestMaxIdleRounds, t) + test.CheckDuration("BlockHashesRequestInterval", c.BlockHashesRequestInterval, 300*time.Millisecond, t) + test.CheckDuration("BlocksRequestInterval", c.BlocksRequestInterval, 100*time.Millisecond, t) + test.CheckDuration("BlockHashesTimeout", c.BlockHashesTimeout, 90*time.Second, t) + test.CheckDuration("BlocksTimeout", c.BlocksTimeout, blocksTimeout, t) +} |