mining

package
v0.0.0-...-910d698 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const TPERIOD int = config.BLOCK_CREATE_PERIOD * 1000000000

Variables

This section is empty.

Functions

func SimulateTransaction

func SimulateTransaction(id int)

Types

type ChainInfoCmd

type ChainInfoCmd struct {
	Cmd string `json:"cmd"`
}

type Mining

type Mining struct {
	// contains filtered or unexported fields
}

func MiningInst

func MiningInst() *Mining

func (*Mining) AddTransactionToPool

func (mi *Mining) AddTransactionToPool(key string, data *blockchain.Transaction) bool

Add transaction to the pool true : If new transaction false : the transaction already exists in the pool

func (*Mining) BroadcasTransaction

func (mi *Mining) BroadcasTransaction(t *blockchain.Transaction)

Update peers list

func (*Mining) BroadcastNewBlock

func (mi *Mining) BroadcastNewBlock(b *blockchain.Block)

func (*Mining) DeleteTransactionsFromPool

func (mi *Mining) DeleteTransactionsFromPool(keys []string)

func (*Mining) GetTargetNodePoS

func (mi *Mining) GetTargetNodePoS(nodes [config.MAX_SC * config.MAX_SC_PEER]dtype.NodeInfo) *dtype.NodeInfo

func (*Mining) GetTransactionsFromPool

func (mi *Mining) GetTransactionsFromPool() []*blockchain.Transaction

func (*Mining) SetHttpRouter

func (mi *Mining) SetHttpRouter(m *mux.Router)

func (*Mining) ShowTransactionsFromPool

func (mi *Mining) ShowTransactionsFromPool()

func (*Mining) StartMiningNewBlock

func (mi *Mining) StartMiningNewBlock(status *string)

func (*Mining) UpdateTransactionPool

func (mi *Mining) UpdateTransactionPool(block *blockchain.Block)

type SensorData

type SensorData struct {
	Id          int     `json:"id"`
	Timestamp   int64   `json:"Timestamp"`
	Temperature float64 `json:"Fridge_Temperature"`
	Condition   string  `json:"Temp_Condition"`
}

type WalletMgr

type WalletMgr struct {
	// contains filtered or unexported fields
}

func WalletMgrInst

func WalletMgrInst(path string) *WalletMgr

func (*WalletMgr) GetWallet

func (wm *WalletMgr) GetWallet() *wallet.Wallet

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL