mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-04 01:54:28 +00:00
878cc063b0
* Fixing headers stuck in StageSync * Removed ./dev folder and cleaned up code * Removing the logs subscription tests
41 lines
702 B
Go
41 lines
702 B
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/ledgerwatch/erigon/cmd/devnettest/services"
|
|
"github.com/spf13/cobra"
|
|
"sync"
|
|
)
|
|
|
|
var (
|
|
//eventAddrs = []string{devAddress, recvAddr}
|
|
eventTopics []string
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(LogsCmd)
|
|
}
|
|
|
|
var LogsCmd = &cobra.Command{
|
|
Use: "logs",
|
|
Short: "Subscribes to log event sends a notification each time a new log appears",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
callLogs()
|
|
},
|
|
}
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
func callLogs() {
|
|
wg.Add(1)
|
|
go func() {
|
|
if err := services.Logs([]string{}, eventTopics); err != nil {
|
|
fmt.Printf("could not subscribe to log events: %v\n", err)
|
|
}
|
|
defer wg.Done()
|
|
}()
|
|
wg.Wait()
|
|
|
|
callContractTx()
|
|
}
|