Skip to content

Commit 74401f5

Browse files
committed
perf: field align structs
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
1 parent 3506e4b commit 74401f5

7 files changed

Lines changed: 31 additions & 31 deletions

File tree

internal/config/config.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ import (
2727
)
2828

2929
type Config struct {
30-
Logging LoggingConfig `yaml:"logging"`
31-
Storage StorageConfig `yaml:"storage"`
32-
Indexer IndexerConfig `yaml:"indexer"`
3330
Submit SubmitConfig `yaml:"submit"`
31+
Storage StorageConfig `yaml:"storage"`
3432
Wallet WalletConfig `yaml:"wallet"`
35-
Miner MinerConfig `yaml:"miner"`
36-
Metrics MetricsConfig `yaml:"metrics"`
37-
Debug DebugConfig `yaml:"debug"`
3833
Profile string `yaml:"profile" envconfig:"PROFILE"`
3934
Network string `yaml:"network" envconfig:"NETWORK"`
35+
Indexer IndexerConfig `yaml:"indexer"`
36+
Metrics MetricsConfig `yaml:"metrics"`
37+
Debug DebugConfig `yaml:"debug"`
38+
Miner MinerConfig `yaml:"miner"`
4039
NetworkMagic uint32
40+
Logging LoggingConfig `yaml:"logging"`
4141
}
4242

4343
type LoggingConfig struct {
@@ -68,9 +68,9 @@ type WalletConfig struct {
6868
}
6969

7070
type MinerConfig struct {
71+
Message string `yaml:"message" envconfig:"MINER_MESSAGE"`
7172
WorkerCount int `yaml:"workers" envconfig:"WORKER_COUNT"`
7273
HashRateInterval int `yaml:"hashRateInterval" envconfig:"HASH_RATE_INTERVAL"`
73-
Message string `yaml:"message" envconfig:"MINER_MESSAGE"`
7474
}
7575

7676
type MetricsConfig struct {

internal/config/profiles.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
package config
1616

1717
type Profile struct {
18-
InterceptHash string
19-
InterceptSlot uint64
18+
ScriptInputRefTxId string
2019
ScriptAddress string
2120
ValidatorHash string
2221
MintValidatorHash string
2322
ValidatorScript string
24-
ScriptInputRefTxId string
25-
ScriptInputRefOutIndex uint32
26-
ScriptRefInputs []RefInput
23+
InterceptHash string
2724
SeedHashes []string
28-
UseTunaV1 bool
29-
TunaV2OldTargetStateOrder bool
25+
ScriptRefInputs []RefInput
3026
EpochNumber int
27+
InterceptSlot uint64
3128
EpochTarget int
29+
ScriptInputRefOutIndex uint32
30+
UseTunaV1 bool
31+
TunaV2OldTargetStateOrder bool
3232
}
3333

3434
func GetProfile() Profile {

internal/indexer/indexer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ const (
4343
)
4444

4545
type Indexer struct {
46+
lastBlockData any
4647
pipeline *pipeline.Pipeline
47-
cursorSlot uint64
48+
syncLogTimer *time.Timer
4849
cursorHash string
49-
tipSlot uint64
5050
tipHash string
51+
cursorSlot uint64
52+
tipSlot uint64
5153
tipReached bool
52-
syncLogTimer *time.Timer
53-
lastBlockData any
5454
}
5555

5656
// Singleton indexer instance

internal/miner/miner.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ type TargetState interface {
5353
}
5454

5555
type TargetStateV1 struct {
56-
Nonce [16]byte
57-
BlockNumber int64
5856
CurrentHash []byte
57+
BlockNumber int64
5958
LeadingZeros int64
6059
DifficultyNumber int64
6160
EpochTime int64
61+
Nonce [16]byte
6262
}
6363

6464
func (t *TargetStateV1) SetNonce(nonce [16]byte) {
@@ -85,14 +85,14 @@ func (state *TargetStateV1) MarshalCBOR() ([]byte, error) {
8585
}
8686

8787
type TargetStateV2 struct {
88-
Nonce [16]byte
8988
MinerCredHash []byte
89+
CurrentHash []byte
90+
cachedCbor []byte
9091
EpochTime int64
9192
BlockNumber int64
92-
CurrentHash []byte
9393
LeadingZeros int64
9494
DifficultyNumber int64
95-
cachedCbor []byte
95+
Nonce [16]byte
9696
}
9797

9898
func (t *TargetStateV2) SetNonce(nonce [16]byte) {

internal/miner/worker.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ const (
3030
)
3131

3232
type Manager struct {
33-
workerWaitGroup sync.WaitGroup
33+
lastBlockData any
3434
doneChan chan any
3535
resultChan chan Result
36-
started bool
37-
startMutex sync.Mutex
38-
stopMutex sync.Mutex
3936
hashCounter *atomic.Uint64
4037
hashLogTimer *time.Timer
41-
hashLogLastCount uint64
4238
restartTimer *time.Timer
43-
lastBlockData any
39+
workerWaitGroup sync.WaitGroup
40+
hashLogLastCount uint64
41+
startMutex sync.Mutex
42+
stopMutex sync.Mutex
43+
started bool
4444
}
4545

4646
var globalManager = &Manager{}

internal/storage/storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ const (
3636
)
3737

3838
type Storage struct {
39-
sync.Mutex
4039
db *badger.DB
4140
trie *Trie
41+
sync.Mutex
4242
}
4343

4444
var globalStorage = &Storage{}

internal/storage/trie.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ import (
3030
)
3131

3232
type Trie struct {
33-
sync.Mutex
3433
db *badger.DB
3534
trie *mpf.Trie
3635
keyPrefix []byte
36+
sync.Mutex
3737
}
3838

3939
func NewTrie(db *badger.DB, keyPrefix string) (*Trie, error) {

0 commit comments

Comments
 (0)