-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathconfig.go
82 lines (64 loc) · 1.75 KB
/
config.go
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
package interpreter
import "math"
type config interface {
AfterGenesis() bool
MaxOps() int
MaxStackSize() int
MaxScriptSize() int
MaxScriptElementSize() int
MaxScriptNumberLength() int
MaxPubKeysPerMultiSig() int
}
// Limits applied to transactions before genesis
const (
MaxOpsBeforeGenesis = 500
MaxStackSizeBeforeGenesis = 1000
MaxScriptSizeBeforeGenesis = 10000
MaxScriptElementSizeBeforeGenesis = 520
MaxScriptNumberLengthBeforeGenesis = 4
MaxPubKeysPerMultiSigBeforeGenesis = 20
)
type beforeGenesisConfig struct{}
type afterGenesisConfig struct{}
func (a *afterGenesisConfig) AfterGenesis() bool {
return true
}
func (b *beforeGenesisConfig) AfterGenesis() bool {
return false
}
func (a *afterGenesisConfig) MaxStackSize() int {
return math.MaxInt32
}
func (b *beforeGenesisConfig) MaxStackSize() int {
return MaxStackSizeBeforeGenesis
}
func (a *afterGenesisConfig) MaxScriptSize() int {
return math.MaxInt32
}
func (b *beforeGenesisConfig) MaxScriptSize() int {
return MaxScriptSizeBeforeGenesis
}
func (a *afterGenesisConfig) MaxScriptElementSize() int {
return math.MaxInt32
}
func (b *beforeGenesisConfig) MaxScriptElementSize() int {
return MaxScriptElementSizeBeforeGenesis
}
func (a *afterGenesisConfig) MaxScriptNumberLength() int {
return 750 * 1000 // 750 * 1Kb
}
func (b *beforeGenesisConfig) MaxScriptNumberLength() int {
return MaxScriptNumberLengthBeforeGenesis
}
func (a *afterGenesisConfig) MaxOps() int {
return math.MaxInt32
}
func (b *beforeGenesisConfig) MaxOps() int {
return MaxOpsBeforeGenesis
}
func (a *afterGenesisConfig) MaxPubKeysPerMultiSig() int {
return math.MaxInt32
}
func (b *beforeGenesisConfig) MaxPubKeysPerMultiSig() int {
return MaxPubKeysPerMultiSigBeforeGenesis
}