mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-03 20:56:42 +00:00

* Block template cache improvement * Avoid concurrent calls to template builder * Clear cache on new block event * Move IsNearlySynced logic to within consensus and cache it for each template * Use a single consensus call for building template and checking synced Co-authored-by: msutton <mikisiton2@gmail.com>
20 lines
597 B
Go
20 lines
597 B
Go
package externalapi
|
|
|
|
// DomainBlockTemplate contains a Block plus metadata related to its generation
|
|
type DomainBlockTemplate struct {
|
|
Block *DomainBlock
|
|
CoinbaseData *DomainCoinbaseData
|
|
CoinbaseHasRedReward bool
|
|
IsNearlySynced bool
|
|
}
|
|
|
|
// Clone returns a clone of DomainBlockTemplate
|
|
func (bt *DomainBlockTemplate) Clone() *DomainBlockTemplate {
|
|
return &DomainBlockTemplate{
|
|
Block: bt.Block.Clone(),
|
|
CoinbaseData: bt.CoinbaseData.Clone(),
|
|
CoinbaseHasRedReward: bt.CoinbaseHasRedReward,
|
|
IsNearlySynced: bt.IsNearlySynced,
|
|
}
|
|
}
|