mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
core: improve documentation a little
This commit is contained in:
parent
f2033b5e54
commit
ac40d357f0
2 changed files with 12 additions and 3 deletions
|
@ -64,7 +64,9 @@ var (
|
|||
persistInterval = 1 * time.Second
|
||||
)
|
||||
|
||||
// Blockchain represents the blockchain.
|
||||
// Blockchain represents the blockchain. It maintans internal state representing
|
||||
// the state of the ledger that can be accessed in various ways and changed by
|
||||
// adding new blocks or headers.
|
||||
type Blockchain struct {
|
||||
config config.ProtocolConfiguration
|
||||
|
||||
|
@ -130,7 +132,8 @@ type Blockchain struct {
|
|||
type headersOpFunc func(headerList *HeaderHashList)
|
||||
|
||||
// NewBlockchain returns a new blockchain object the will use the
|
||||
// given Store as its underlying storage.
|
||||
// given Store as its underlying storage. For it to work correctly you need
|
||||
// to spawn a goroutine for its Run method after this initialization.
|
||||
func NewBlockchain(s storage.Store, cfg config.ProtocolConfiguration, log *zap.Logger) (*Blockchain, error) {
|
||||
if log == nil {
|
||||
return nil, errors.New("empty logger")
|
||||
|
@ -269,7 +272,8 @@ func (bc *Blockchain) init() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Run runs chain loop.
|
||||
// Run runs chain loop, it needs to be run as goroutine and executing it is
|
||||
// critical for correct Blockchain operation.
|
||||
func (bc *Blockchain) Run() {
|
||||
persistTimer := time.NewTimer(persistInterval)
|
||||
defer func() {
|
||||
|
|
5
pkg/core/doc.go
Normal file
5
pkg/core/doc.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
/*
|
||||
Package core implements Neo ledger functionality.
|
||||
It's built around the Blockchain structure that maintains state of the ledger.
|
||||
*/
|
||||
package core
|
Loading…
Reference in a new issue