Documentation
¶
Index ¶
- Constants
- type Application
- type ConfigFile
- type LedgerClient
- type LedgerClientMock
- func (m *LedgerClientMock) GetBlocks(ctx context.Context, in *ccmsg.GetBlocksRequest, opts ...grpc.CallOption) (*ccmsg.GetBlocksResponse, error)
- func (m *LedgerClientMock) PostTransaction(ctx context.Context, in *ccmsg.PostTransactionRequest, opts ...grpc.CallOption) (*ccmsg.PostTransactionResponse, error)
- type LedgerDatabase
- func (m *LedgerDatabase) DeleteMempoolTX(ctx context.Context, txid ledger_models.TXID) error
- func (m *LedgerDatabase) DeleteUtxo(ctx context.Context, outpoint ledger.OutpointKey) error
- func (m *LedgerDatabase) HighestBlock(ctx context.Context) (*models.Block, error)
- func (m *LedgerDatabase) InsertBlock(ctx context.Context, blockModel *models.Block) error
- func (m *LedgerDatabase) InsertUtxo(ctx context.Context, utxo *models.Utxo) error
- func (m *LedgerDatabase) MempoolTXs(ctx context.Context) ([]*models.MempoolTransaction, error)
- func (m *LedgerDatabase) QueueTX(ctx context.Context, tx *models.MempoolTransaction) error
- func (m *LedgerDatabase) UpdateAuditLog(ctx context.Context, txid ledger_models.TXID, status string) error
- func (m *LedgerDatabase) Utxo(ctx context.Context, outpoint ledger.OutpointKey) (*models.Utxo, error)
- type LedgerMemory
- func (m *LedgerMemory) DeleteMempoolTX(ctx context.Context, txid ledger_models.TXID) error
- func (m *LedgerMemory) DeleteUtxo(ctx context.Context, outpoint ledger.OutpointKey) error
- func (m *LedgerMemory) HighestBlock(ctx context.Context) (*models.Block, error)
- func (m *LedgerMemory) InsertBlock(ctx context.Context, blockModel *models.Block) error
- func (m *LedgerMemory) InsertUtxo(ctx context.Context, utxo *models.Utxo) error
- func (m *LedgerMemory) MempoolTXs(ctx context.Context) ([]*models.MempoolTransaction, error)
- func (m *LedgerMemory) QueueTX(ctx context.Context, tx *models.MempoolTransaction) error
- func (m *LedgerMemory) UpdateAuditLog(ctx context.Context, txid ledger_models.TXID, status string) error
- func (m *LedgerMemory) Utxo(ctx context.Context, outpoint ledger.OutpointKey) (*models.Utxo, error)
- type LedgerMiner
- func (m *LedgerMiner) AddOutputsToDatabase(ctx context.Context, txid ledger_models.TXID, ...) error
- func (m *LedgerMiner) ApplyBlock(ctx context.Context, block *ledger.Block, spentUtxos []ledger.OutpointKey) (*ledger.Block, error)
- func (m *LedgerMiner) BlockScheduler(ctx context.Context) bool
- func (m *LedgerMiner) BlockSchedulerImmediate(ctx context.Context) bool
- func (m *LedgerMiner) BlockSchedulerTimer(ctx context.Context) bool
- func (m *LedgerMiner) FillBlock(ctx context.Context, state *ledger.SpendingState, ...) ([]*models.MempoolTransaction, error)
- func (m *LedgerMiner) GenerateBlock(ctx context.Context) (*ledger.Block, error)
- func (m *LedgerMiner) GetUtxo(ctx context.Context, outpoint ledger.OutpointKey, state *ledger.SpendingState) (*ledger.TransactionOutput, error)
- func (m *LedgerMiner) InitGenesisBlock(ctx context.Context, totalCoins uint32) (*ledger.Block, error)
- func (m *LedgerMiner) QueueTX(ctx context.Context, tx *ledger.Transaction) error
- func (m *LedgerMiner) Run(ctx context.Context)
- func (m *LedgerMiner) SetupCurrentBlock(ctx context.Context, totalCoins uint32) error
- func (m *LedgerMiner) ValidateTX(ctx context.Context, tx ledger.Transaction, state *ledger.SpendingState) error
- type LedgerService
- type LedgerStorage
Constants ¶
View Source
const MAX_PACKING_ATTEMPTS = 10
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application interface {
common.StarterShutdowner
}
func NewApplication ¶
func NewApplication(l *logrus.Logger, p *LedgerService, db *sql.DB, conf *ConfigFile) (Application, error)
XXX: Should this take p as an argument, or be responsible for setting it up?
type ConfigFile ¶
type ConfigFile struct {
LedgerProtocolAddr string
StatusAddr string
Database string `json:"database"`
Insecure bool `json:"insecure"`
}
func (*ConfigFile) FillDefaults ¶
func (c *ConfigFile) FillDefaults()
FillDefaults fills in defaults in the config file.
type LedgerClient ¶
type LedgerClient struct {
GrpcClient ccmsg.LedgerClient
// contains filtered or unexported fields
}
LedgerClient provides access to the ledger over GRPC
func NewLedgerClient ¶
NewLedgerClient creates a new LedgerClient
type LedgerClientMock ¶
func NewLedgerClientMock ¶
func NewLedgerClientMock() *LedgerClientMock
func (*LedgerClientMock) GetBlocks ¶
func (m *LedgerClientMock) GetBlocks(ctx context.Context, in *ccmsg.GetBlocksRequest, opts ...grpc.CallOption) (*ccmsg.GetBlocksResponse, error)
func (*LedgerClientMock) PostTransaction ¶
func (m *LedgerClientMock) PostTransaction(ctx context.Context, in *ccmsg.PostTransactionRequest, opts ...grpc.CallOption) (*ccmsg.PostTransactionResponse, error)
type LedgerDatabase ¶
type LedgerDatabase struct{}
func NewLedgerDatabase ¶
func NewLedgerDatabase() *LedgerDatabase
func (*LedgerDatabase) DeleteMempoolTX ¶
func (m *LedgerDatabase) DeleteMempoolTX(ctx context.Context, txid ledger_models.TXID) error
func (*LedgerDatabase) DeleteUtxo ¶
func (m *LedgerDatabase) DeleteUtxo(ctx context.Context, outpoint ledger.OutpointKey) error
func (*LedgerDatabase) HighestBlock ¶
func (*LedgerDatabase) InsertBlock ¶
func (*LedgerDatabase) InsertUtxo ¶
func (*LedgerDatabase) MempoolTXs ¶
func (m *LedgerDatabase) MempoolTXs(ctx context.Context) ([]*models.MempoolTransaction, error)
func (*LedgerDatabase) QueueTX ¶
func (m *LedgerDatabase) QueueTX(ctx context.Context, tx *models.MempoolTransaction) error
func (*LedgerDatabase) UpdateAuditLog ¶
func (m *LedgerDatabase) UpdateAuditLog(ctx context.Context, txid ledger_models.TXID, status string) error
func (*LedgerDatabase) Utxo ¶
func (m *LedgerDatabase) Utxo(ctx context.Context, outpoint ledger.OutpointKey) (*models.Utxo, error)
type LedgerMemory ¶
type LedgerMemory struct {
// contains filtered or unexported fields
}
func NewLedgerMemory ¶
func NewLedgerMemory() *LedgerMemory
func (*LedgerMemory) DeleteMempoolTX ¶
func (m *LedgerMemory) DeleteMempoolTX(ctx context.Context, txid ledger_models.TXID) error
func (*LedgerMemory) DeleteUtxo ¶
func (m *LedgerMemory) DeleteUtxo(ctx context.Context, outpoint ledger.OutpointKey) error
func (*LedgerMemory) HighestBlock ¶
func (*LedgerMemory) InsertBlock ¶
func (*LedgerMemory) InsertUtxo ¶
func (*LedgerMemory) MempoolTXs ¶
func (m *LedgerMemory) MempoolTXs(ctx context.Context) ([]*models.MempoolTransaction, error)
func (*LedgerMemory) QueueTX ¶
func (m *LedgerMemory) QueueTX(ctx context.Context, tx *models.MempoolTransaction) error
func (*LedgerMemory) UpdateAuditLog ¶
func (m *LedgerMemory) UpdateAuditLog(ctx context.Context, txid ledger_models.TXID, status string) error
func (*LedgerMemory) Utxo ¶
func (m *LedgerMemory) Utxo(ctx context.Context, outpoint ledger.OutpointKey) (*models.Utxo, error)
type LedgerMiner ¶
type LedgerMiner struct {
NewTxChan chan struct{}
Interval time.Duration
CurrentBlock *models.Block
// contains filtered or unexported fields
}
func NewLedgerMiner ¶
func NewLedgerMiner(l *logrus.Logger, storage LedgerStorage, kp *keypair.KeyPair) (*LedgerMiner, error)
func (*LedgerMiner) AddOutputsToDatabase ¶
func (m *LedgerMiner) AddOutputsToDatabase(ctx context.Context, txid ledger_models.TXID, outputs []ledger.TransactionOutput) error
func (*LedgerMiner) ApplyBlock ¶
func (m *LedgerMiner) ApplyBlock(ctx context.Context, block *ledger.Block, spentUtxos []ledger.OutpointKey) (*ledger.Block, error)
func (*LedgerMiner) BlockScheduler ¶
func (m *LedgerMiner) BlockScheduler(ctx context.Context) bool
func (*LedgerMiner) BlockSchedulerImmediate ¶
func (m *LedgerMiner) BlockSchedulerImmediate(ctx context.Context) bool
func (*LedgerMiner) BlockSchedulerTimer ¶
func (m *LedgerMiner) BlockSchedulerTimer(ctx context.Context) bool
func (*LedgerMiner) FillBlock ¶
func (m *LedgerMiner) FillBlock(ctx context.Context, state *ledger.SpendingState, mempoolTXs []*models.MempoolTransaction) ([]*models.MempoolTransaction, error)
func (*LedgerMiner) GenerateBlock ¶
func (*LedgerMiner) GetUtxo ¶
func (m *LedgerMiner) GetUtxo(ctx context.Context, outpoint ledger.OutpointKey, state *ledger.SpendingState) (*ledger.TransactionOutput, error)
func (*LedgerMiner) InitGenesisBlock ¶
func (*LedgerMiner) QueueTX ¶
func (m *LedgerMiner) QueueTX(ctx context.Context, tx *ledger.Transaction) error
func (*LedgerMiner) Run ¶
func (m *LedgerMiner) Run(ctx context.Context)
func (*LedgerMiner) SetupCurrentBlock ¶
func (m *LedgerMiner) SetupCurrentBlock(ctx context.Context, totalCoins uint32) error
func (*LedgerMiner) ValidateTX ¶
func (m *LedgerMiner) ValidateTX(ctx context.Context, tx ledger.Transaction, state *ledger.SpendingState) error
type LedgerService ¶
type LedgerService struct {
// contains filtered or unexported fields
}
func NewLedgerService ¶
func (*LedgerService) GetBlocks ¶
func (s *LedgerService) GetBlocks(ctx context.Context, req *ccmsg.GetBlocksRequest) (*ccmsg.GetBlocksResponse, error)
func (*LedgerService) PostTransaction ¶
func (s *LedgerService) PostTransaction(ctx context.Context, req *ccmsg.PostTransactionRequest) (ptr *ccmsg.PostTransactionResponse, finalErr error)
type LedgerStorage ¶
type LedgerStorage interface {
MempoolTXs(ctx context.Context) ([]*models.MempoolTransaction, error)
Utxo(ctx context.Context, outpoint ledger.OutpointKey) (*models.Utxo, error)
HighestBlock(ctx context.Context) (*models.Block, error)
InsertBlock(ctx context.Context, blockModel *models.Block) error
DeleteMempoolTX(ctx context.Context, txid ledger_models.TXID) error
UpdateAuditLog(ctx context.Context, txid ledger_models.TXID, status string) error
DeleteUtxo(ctx context.Context, outpoint ledger.OutpointKey) error
InsertUtxo(ctx context.Context, utxo *models.Utxo) error
QueueTX(ctx context.Context, tx *models.MempoolTransaction) error
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.