Documentation
¶
Overview ¶
Copyright © 2019 Annchain Authors <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2019 Annchain Authors <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2019 Annchain Authors <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2019 Annchain Authors <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2019 Annchain Authors <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2019 Annchain Authors <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func NewP2PServer(privKey *ecdsa.PrivateKey, bootNode bool) *p2p.Server
- func SetupCallbacks(m *og.MessageRouter, hub *og.Hub)
- func SetupCallbacksOG32(m *og.MessageRouterOG02, hub *og.Hub)
- func StringArrayToIntArray(arr []string) []int
- type AutoClient
- type AutoClientManager
- func (m *AutoClientManager) Init(accountIndices []int, delegate *Delegate, ...)
- func (a *AutoClientManager) JudgeNonce(me *account.SampleAccount) uint64
- func (m *AutoClientManager) Name() string
- func (m *AutoClientManager) SetTxIntervalUs(interval int)
- func (m *AutoClientManager) Start()
- func (m *AutoClientManager) Stop()
- type Component
- type Delegate
- func (c *Delegate) Announce(txi types.Txi)
- func (c *Delegate) GenerateSequencer(r SeqRequest) (seq types.Txi, err error)
- func (c *Delegate) GenerateTx(r TxRequest) (tx types.Txi, err error)
- func (c *Delegate) GetLatestAccountNonce(addr types.Address) (uint64, error)
- func (c *Delegate) GetLatestDagSequencer() *types.Sequencer
- type Node
- type SeqRequest
- type TxRequest
Constants ¶
const ( IntervalModeConstantInterval = "constant" IntervalModeRandom = "random" )
Variables ¶
This section is empty.
Functions ¶
func NewP2PServer ¶
func NewP2PServer(privKey *ecdsa.PrivateKey, bootNode bool) *p2p.Server
func SetupCallbacks ¶
func SetupCallbacks(m *og.MessageRouter, hub *og.Hub)
SetupCallbacks Regist callbacks to handle different messages
func SetupCallbacksOG32 ¶
func SetupCallbacksOG32(m *og.MessageRouterOG02, hub *og.Hub)
func StringArrayToIntArray ¶
Types ¶
type AutoClient ¶
type AutoClient struct {
SampleAccounts []*account.SampleAccount
MyIndex int //only for debug
MyAccount *account.SampleAccount //if MyAccount is
SequencerIntervalUs int
TxIntervalUs int
IntervalMode string
NonceSelfDiscipline bool
AutoSequencerEnabled bool
CampainEnable bool
AutoTxEnabled bool
Delegate *Delegate
ManualChan chan types.TxBaseType
NewRawTx chan types.Txi
// contains filtered or unexported fields
}
func (*AutoClient) Init ¶
func (c *AutoClient) Init()
func (*AutoClient) Pause ¶
func (c *AutoClient) Pause()
func (*AutoClient) Resume ¶
func (c *AutoClient) Resume()
func (*AutoClient) SetTxIntervalUs ¶
func (c *AutoClient) SetTxIntervalUs(i int)
func (*AutoClient) Start ¶
func (c *AutoClient) Start()
func (*AutoClient) Stop ¶
func (c *AutoClient) Stop()
type AutoClientManager ¶
type AutoClientManager struct {
Clients []*AutoClient
SampleAccounts []*account.SampleAccount
UpToDateEventListener chan bool
NodeStatusDataProvider og.NodeStatusDataProvider
RegisterReceiver func(c chan types.Txi)
// contains filtered or unexported fields
}
func (*AutoClientManager) Init ¶
func (m *AutoClientManager) Init(accountIndices []int, delegate *Delegate, coinBaseAccount *account.SampleAccount)
func (*AutoClientManager) JudgeNonce ¶
func (a *AutoClientManager) JudgeNonce(me *account.SampleAccount) uint64
func (*AutoClientManager) Name ¶
func (m *AutoClientManager) Name() string
func (*AutoClientManager) SetTxIntervalUs ¶
func (m *AutoClientManager) SetTxIntervalUs(interval int)
func (*AutoClientManager) Start ¶
func (m *AutoClientManager) Start()
func (*AutoClientManager) Stop ¶
func (m *AutoClientManager) Stop()
type Component ¶
type Component interface {
Start()
Stop()
// Get the component name
Name() string
}
type Delegate ¶
type Delegate struct {
TxCreator *og.TxCreator
TxBuffer *og.TxBuffer
TxPool *core.TxPool
Dag *core.Dag
OnNewTxiGenerated []chan types.Txi
}
func (*Delegate) GenerateSequencer ¶
func (c *Delegate) GenerateSequencer(r SeqRequest) (seq types.Txi, err error)
func (*Delegate) GetLatestAccountNonce ¶
func (*Delegate) GetLatestDagSequencer ¶
type Node ¶
type Node struct {
Components []Component
}
Node is the basic entrypoint for all modules to start.