Repository navigation
Expand file tree
/
Copy pathconfig.go
More file actions
123 lines (99 loc) · 2.72 KB
/
Copy pathconfig.go
File metadata and controls
123 lines (99 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package wakacoin
import (
"math"
"sync"
)
const(
blockChain = "W"
dbFile = "Wakacoin_%s.db"
contractDbFile = "ContractChain_%s.db"
paramBucket = "parameters"
blocksBucket = "blocks"
verifyBucket = "verifyBucket"
utxoBucket_A = "utxoBucket_A"
utxoBucket_B = "utxoBucket_B"
contractBucket_A = "contractBucket_A"
contractBucket_B = "contractBucket_B"
hubsBucket = "hubs"
txsBucket = "txs"
walletFile = "wallet_%s.dat"
blockVersion uint32 = 0
maxBlockSize uint32 = 5242880 //5 MB
stretch float32 = 1.01
maxBlockHeaderPayload uint8 = 85
coinbaseReservedSize uint16 = 700
minTxSize uint8 = 150
maxVins uint16 = 1001
maxTxAmount uint16 = 5000
genesisSubsidy uint32 = 5000
halving uint32 = 2160
maxHalvingRound uint32 = 13
difficultyDefault_0 uint8 = 20
difficultyDefault_1 uint8 = 20
averageBlockTime uint16 = 600
averageBlockTimeBlocks uint8 = 255
averageBlockTimeBlocks_2 uint8 = 60
averageBlockTimeBlocks_3 uint8 = 15
tolerance uint16 = 300
tolerance_2 uint16 = 60
tolerance_3 uint16 = 10
toleranceUpperLimit uint16 = 10
toleranceLowerLimit uint16 = 200
transactionVersion uint32 = 0
spendableOutputConfirmations uint8 = 255
confirmationsError = "The input has not yet reached 255 confirmations"
utxoHaveToBeReindexed = "UTXO have to be reindexed"
utxoCanNotBeUpdated = "UTXO can not be updated"
walletVersion = byte(0x00)
addressChecksumLen uint8 = 4
upgradeNotice = "Please upgrade the software version"
nodeVersion uint32 = 0
protocol = "tcp"
CommandLength uint8 = 14
hubsCounter uint8 = 180
hubsMax uint8 = 5
txidsPacketMax uint8 = 3
protectFromGenesis = "000004c8660c7e4bc9afcc6c0c51ad506ebda759d80fd9d0bd7a9538805b0da2"
protectTo = "0000076c43822ab0eea15f65f0fd0d8251615e1ef13a12fa7c53fa8284d148a6"
protectHeight uint32 = 112690
contractVersion uint32 = 0
)
var (
blockHashesFromGenesisToTip [][32]byte
isRebuilding bool
isVerifyBlocks bool
isVerifying bool
isUpdating bool
inUse []string
knownNodes sync.Map // map[string]uint8
blacklist sync.Map // map[string]int64
nodeId string
nodeAddress string
hostStaticAddress string
hostDomainName string
localhostisDefaultHub bool
MiningAddress string
WebServerLanAddress string
nodeLanAddress string
miningPool bool
nonceFromMinersOfPool uint64
b58Alphabet = []byte("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")
)
func Subsidy(blockHeight uint32) uint32 {
switch {
case blockHeight < halving:
return genesisSubsidy
case blockHeight < halving*maxHalvingRound:
h := float64(halving)
n := float64(blockHeight)
x := n / h
xInt := int(math.Floor(x))
s := float64(genesisSubsidy)
for i := 0; i < xInt; i++ {
s = s / 2
}
return uint32(math.Ceil(s))
default:
return 1
}
}