Skip to content
Snippets Groups Projects
Select Git revision
  • 68fdcf49382514a2d73be0968b2e52ac86f180cf
  • without_tipselection default
  • develop protected
  • fix/grafana-local-dashboard
  • wasp
  • fix/dashboard-explorer-freeze
  • master
  • feat/timerqueue
  • test/sync_debug_and_650
  • feat/sync_revamp_inv
  • wip/sync
  • tool/db-recovery
  • portcheck/fix
  • fix/synchronization
  • feat/new-dashboard-analysis
  • feat/refactored-analysis-dashboard
  • feat/new-analysis-dashboard
  • test/demo-prometheus-fpc
  • prometheus_metrics
  • wip/analysis-server
  • merge/fpc-test-value-transfer
  • v0.2.2
  • v0.2.1
  • v0.2.0
  • v0.1.3
  • v0.1.2
  • v0.1.1
  • v0.1.0
28 results

plugin.go

Blame
  • plugin.go 1000 B
    package pow
    
    import (
    	"github.com/iotaledger/goshimmer/packages/binary/messagelayer/messagefactory"
    	"github.com/iotaledger/goshimmer/packages/binary/messagelayer/messageparser/builtinfilters"
    	"github.com/iotaledger/goshimmer/plugins/messagelayer"
    	"github.com/iotaledger/hive.go/logger"
    	"github.com/iotaledger/hive.go/node"
    )
    
    // PluginName is the name of the PoW plugin.
    const PluginName = "PoW"
    
    var (
    	// Plugin is the plugin instance of the PoW plugin.
    	Plugin = node.NewPlugin(PluginName, node.Enabled, run)
    )
    
    func run(*node.Plugin) {
    	// assure that the logger is available
    	log := logger.NewLogger(PluginName)
    
    	if node.IsSkipped(messagelayer.Plugin()) {
    		log.Infof("%s is disabled; skipping %s\n", messagelayer.PluginName, PluginName)
    		return
    	}
    
    	// assure that the PoW worker is initialized
    	worker := Worker()
    
    	messagelayer.MessageParser().AddBytesFilter(builtinfilters.NewPowFilter(worker, difficulty))
    	messagelayer.MessageFactory().SetWorker(messagefactory.WorkerFunc(DoPOW))
    }