Skip to content

Commit

Permalink
pass input regex from state to bmv (#1071)
Browse files Browse the repository at this point in the history
  • Loading branch information
WhoSoup authored Oct 6, 2020
1 parent 10f72f1 commit f66a363
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/debugsettings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *Settings) UpdateInputRegex(re string) error {
return nil
}

func (s *Settings) UpdateOuputRegex(re string) error {
func (s *Settings) UpdateOutputRegex(re string) error {
v, err := regexp.Compile(re)
if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion simTest/MessageFilteringInput_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package simtest

import (
"github.com/FactomProject/factomd/testHelper/simulation"
"strings"
"testing"

"github.com/FactomProject/factomd/testHelper/simulation"

"github.com/FactomProject/factomd/fnode"

. "github.com/FactomProject/factomd/testHelper"
Expand Down
7 changes: 7 additions & 0 deletions state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/FactomProject/factomd/database/databaseOverlay"
"github.com/FactomProject/factomd/database/leveldb"
"github.com/FactomProject/factomd/database/mapdb"
"github.com/FactomProject/factomd/modules/debugsettings"
"github.com/FactomProject/factomd/modules/events"
"github.com/FactomProject/factomd/modules/pubsub"
"github.com/FactomProject/factomd/modules/pubsub/pubregistry"
Expand Down Expand Up @@ -2376,6 +2377,9 @@ func (s *State) PassOutputRegEx(RegEx *regexp.Regexp, RegExString string) {
s.LogPrintf("networkOutputs", "SetOutputRegEx to '%s'", RegExString)
s.OutputRegEx = RegEx
s.OutputRegExString = RegExString
// this returns an error but the function that calls PassOutputRegEx already ran a
// .MustCompile on the string, so it will compile a second time
debugsettings.GetSettings(s.GetFactomNodeName()).UpdateOutputRegex(RegExString)
}

func (s *State) GetOutputRegEx() (*regexp.Regexp, string) {
Expand All @@ -2386,6 +2390,9 @@ func (s *State) PassInputRegEx(RegEx *regexp.Regexp, RegExString string) {
s.LogPrintf("networkInputs", "SetInputRegEx to '%s'", RegExString)
s.InputRegEx = RegEx
s.InputRegExString = RegExString
// this returns an error but the function that calls PassInputRegEx already ran a
// .MustCompile on the string, so it will compile a second time
debugsettings.GetSettings(s.GetFactomNodeName()).UpdateInputRegex(RegExString)
}

func (s *State) GetInputRegEx() (*regexp.Regexp, string) {
Expand Down

0 comments on commit f66a363

Please sign in to comment.