micw/server/core/block_pipeline.go
2024-11-13 22:10:13 +01:00

48 lines
929 B
Go

package core
import (
"context"
"mic-wallet/server/repository/entities"
"sync"
"time"
)
type BlockData struct {
Lock *sync.RWMutex
prevHash []byte
Transactions map[string]entities.NewTransactionOpts
}
// BlocksPipeline does block rotation, writes transaction into the block or block queue
// write blocks when they are finished.
type BlocksPipeline struct {
cooldown time.Duration
writeToBlock uint8
block1 *BlockData
block2 *BlockData
block3 *BlockData
}
func NewBlockPipeline(cooldown time.Duration) *BlocksPipeline {
return &BlocksPipeline{}
}
func (b *BlocksPipeline) loadPrevBlockHash(ctx context.Context) {
}
func (b *BlocksPipeline) rotate(ctx context.Context) error {
return nil
}
func (b *BlocksPipeline) NewTransaction(ctx context.Context, opts NewTransactionOpts) error {
return nil
}
func (b *BlocksPipeline) Run(ctx context.Context) error {
return nil
}