protofsm: add String() method to ProtocolState

This commit is contained in:
Olaoluwa Osuntokun committed 2025-03-18 11:44:20 -05:00
1 parent 01382f4c2a
commit 1d2c22d140
3 files changed
+65 -3

No files matched your search

+4 -3
View File
@@ -77,7 +77,8 @@ type State[Event any, Env Environment] interface {
// otherwise.
IsTerminal() bool
// TODO(roasbeef): also add state serialization?
// String returns a human readable string that represents the state.
String() string
}
// DaemonAdapters is a set of methods that server as adapters to bridge the
@@ -597,8 +598,8 @@ func (s *StateMachine[Event, Env]) applyEvents(ctx context.Context,
}
s.log.InfoS(ctx, "State transition",
btclog.Fmt("from_state", "%T", currentState),
btclog.Fmt("to_state", "%T", transition.NextState))
btclog.Fmt("from_state", "%v", currentState),
btclog.Fmt("to_state", "%v", transition.NextState))
// With our events processed, we'll now update our
// internal state.