network_params.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Copyright 2017 The go-ethereum Authors
  2. // This file is part of the go-ethereum library.
  3. //
  4. // The go-ethereum library is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Lesser General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // The go-ethereum library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public License
  15. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
  16. package params
  17. // These are network parameters that need to be constant between clients, but
  18. // aren't necessarily consensus related.
  19. const (
  20. // BloomBitsBlocks is the number of blocks a single bloom bit section vector
  21. // contains on the server side.
  22. BloomBitsBlocks uint64 = 4096
  23. // BloomBitsBlocksClient is the number of blocks a single bloom bit section vector
  24. // contains on the light client side
  25. BloomBitsBlocksClient uint64 = 32768
  26. // BloomConfirms is the number of confirmation blocks before a bloom section is
  27. // considered probably final and its rotated bits are calculated.
  28. BloomConfirms = 256
  29. // CHTFrequency is the block frequency for creating CHTs
  30. CHTFrequency = 32768
  31. // BloomTrieFrequency is the block frequency for creating BloomTrie on both
  32. // server/client sides.
  33. BloomTrieFrequency = 32768
  34. // HelperTrieConfirmations is the number of confirmations before a client is expected
  35. // to have the given HelperTrie available.
  36. HelperTrieConfirmations = 2048
  37. // HelperTrieProcessConfirmations is the number of confirmations before a HelperTrie
  38. // is generated
  39. HelperTrieProcessConfirmations = 256
  40. // CheckpointFrequency is the block frequency for creating checkpoint
  41. CheckpointFrequency = 32768
  42. // CheckpointProcessConfirmations is the number before a checkpoint is generated
  43. CheckpointProcessConfirmations = 256
  44. // FullImmutabilityThreshold is the number of blocks after which a chain segment is
  45. // considered immutable (i.e. soft finality). It is used by the downloader as a
  46. // hard limit against deep ancestors, by the blockchain against deep reorgs, by
  47. // the freezer as the cutoff threshold and by clique as the snapshot trust limit.
  48. FullImmutabilityThreshold = 90000
  49. // LightImmutabilityThreshold is the number of blocks after which a header chain
  50. // segment is considered immutable for light client(i.e. soft finality). It is used by
  51. // the downloader as a hard limit against deep ancestors, by the blockchain against deep
  52. // reorgs, by the light pruner as the pruning validity guarantee.
  53. LightImmutabilityThreshold = 30000
  54. )
  55. // //Quorum
  56. var quorumImmutabilityThreshold int
  57. // returns the immutability threshold set for the network
  58. func GetImmutabilityThreshold() int {
  59. if quorumImmutabilityThreshold > 0 {
  60. return quorumImmutabilityThreshold
  61. }
  62. return FullImmutabilityThreshold
  63. }
  64. func GetImmutabilityThresholdWithDefault(defaultValue int) int {
  65. if quorumImmutabilityThreshold > 0 {
  66. return quorumImmutabilityThreshold
  67. }
  68. return defaultValue
  69. }
  70. // sets the immutability threshold and isQuorum to passed values
  71. func SetQuorumImmutabilityThreshold(immutabilityThreshold int) {
  72. quorumImmutabilityThreshold = immutabilityThreshold
  73. }
  74. // /Quorum