mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-21 22:36:42 +00:00

* Refactor miner and mine when waiting for block to validate * Fix -n to work after the refactor. Change foundBlockChan capacity. Use lock instead of atomic in the template manager. * Fix self assignment * Fix lock * Fix Dockerfile * Add comment
24 lines
510 B
Go
24 lines
510 B
Go
package templatemanager
|
|
|
|
import (
|
|
"github.com/kaspanet/kaspad/app/appmessage"
|
|
"sync"
|
|
)
|
|
|
|
var currentTemplate *appmessage.GetBlockTemplateResponseMessage
|
|
var lock = &sync.Mutex{}
|
|
|
|
// Get returns the template to work on
|
|
func Get() *appmessage.GetBlockTemplateResponseMessage {
|
|
lock.Lock()
|
|
defer lock.Unlock()
|
|
return currentTemplate
|
|
}
|
|
|
|
// Set sets the current template to work on
|
|
func Set(template *appmessage.GetBlockTemplateResponseMessage) {
|
|
lock.Lock()
|
|
defer lock.Unlock()
|
|
currentTemplate = template
|
|
}
|