diff --git a/node/cmd/guardiand/node.go b/node/cmd/guardiand/node.go index 93c13537eb..4518b55724 100644 --- a/node/cmd/guardiand/node.go +++ b/node/cmd/guardiand/node.go @@ -1019,7 +1019,7 @@ func runNode(cmd *cobra.Command, args []string) { // Run supervisor. supervisor.New(rootCtx, logger, func(ctx context.Context) error { if err := supervisor.Run(ctx, "p2p", p2p.Run( - obsvC, obsvReqC, obsvReqSendC, sendC, signedInC, priv, gk, gst, *p2pPort, *p2pNetworkID, *p2pBootstrap, *nodeName, *disableHeartbeatVerify, rootCtxCancel, gov, nil, nil)); err != nil { + obsvC, obsvReqC, obsvReqSendC, sendC, signedInC, priv, gk, gst, *p2pPort, *p2pNetworkID, *p2pBootstrap, *nodeName, *disableHeartbeatVerify, rootCtxCancel, acct, gov, nil, nil)); err != nil { return err } diff --git a/node/cmd/spy/spy.go b/node/cmd/spy/spy.go index 4cae751618..7ea824f5dd 100644 --- a/node/cmd/spy/spy.go +++ b/node/cmd/spy/spy.go @@ -530,7 +530,7 @@ func runSpy(cmd *cobra.Command, args []string) { // Run supervisor. supervisor.New(rootCtx, logger, func(ctx context.Context) error { - if err := supervisor.Run(ctx, "p2p", p2p.Run(obsvC, obsvReqC, nil, sendC, signedInC, priv, nil, gst, *p2pPort, *p2pNetworkID, *p2pBootstrap, "", false, rootCtxCancel, nil, nil, nil)); err != nil { + if err := supervisor.Run(ctx, "p2p", p2p.Run(obsvC, obsvReqC, nil, sendC, signedInC, priv, nil, gst, *p2pPort, *p2pNetworkID, *p2pBootstrap, "", false, rootCtxCancel, nil, nil, nil, nil)); err != nil { return err } diff --git a/node/pkg/accounting/accounting.go b/node/pkg/accounting/accounting.go index c0737e089b..76e0962ce3 100644 --- a/node/pkg/accounting/accounting.go +++ b/node/pkg/accounting/accounting.go @@ -171,6 +171,13 @@ func (acct *Accounting) Close() { } } +func (acct *Accounting) FeatureString() string { + if !acct.enforceFlag { + return "acct:logonly" + } + return "acct:enforced" +} + // SubmitObservation will submit token bridge transfers to the accounting smart contract. This is called from the processor // loop when a local observation is received from a watcher. It returns true if the observation can be published immediately, // false if not (because it has been submitted to accounting). diff --git a/node/pkg/p2p/p2p.go b/node/pkg/p2p/p2p.go index 92da1c2848..e12fb9b9ce 100644 --- a/node/pkg/p2p/p2p.go +++ b/node/pkg/p2p/p2p.go @@ -8,6 +8,7 @@ import ( "strings" "time" + "github.com/certusone/wormhole/node/pkg/accounting" node_common "github.com/certusone/wormhole/node/pkg/common" "github.com/certusone/wormhole/node/pkg/governor" "github.com/certusone/wormhole/node/pkg/version" @@ -67,8 +68,26 @@ func signedObservationRequestDigest(b []byte) common.Hash { return ethcrypto.Keccak256Hash(append(signedObservationRequestPrefix, b...)) } -func Run(obsvC chan *gossipv1.SignedObservation, obsvReqC chan *gossipv1.ObservationRequest, obsvReqSendC chan *gossipv1.ObservationRequest, sendC chan []byte, signedInC chan *gossipv1.SignedVAAWithQuorum, priv crypto.PrivKey, gk *ecdsa.PrivateKey, gst *node_common.GuardianSetState, port uint, networkID string, bootstrapPeers string, nodeName string, disableHeartbeatVerify bool, rootCtxCancel context.CancelFunc, gov *governor.ChainGovernor, signedGovCfg chan *gossipv1.SignedChainGovernorConfig, - signedGovSt chan *gossipv1.SignedChainGovernorStatus) func(ctx context.Context) error { +func Run( + obsvC chan *gossipv1.SignedObservation, + obsvReqC chan *gossipv1.ObservationRequest, + obsvReqSendC chan *gossipv1.ObservationRequest, + sendC chan []byte, + signedInC chan *gossipv1.SignedVAAWithQuorum, + priv crypto.PrivKey, + gk *ecdsa.PrivateKey, + gst *node_common.GuardianSetState, + port uint, + networkID string, + bootstrapPeers string, + nodeName string, + disableHeartbeatVerify bool, + rootCtxCancel context.CancelFunc, + acct *accounting.Accounting, + gov *governor.ChainGovernor, + signedGovCfg chan *gossipv1.SignedChainGovernorConfig, + signedGovSt chan *gossipv1.SignedChainGovernorStatus, +) func(ctx context.Context) error { return func(ctx context.Context) (re error) { logger := supervisor.Logger(ctx) @@ -211,6 +230,9 @@ func Run(obsvC chan *gossipv1.SignedObservation, obsvReqC chan *gossipv1.Observa if gov != nil { features = append(features, "governor") } + if acct != nil { + features = append(features, acct.FeatureString()) + } heartbeat := &gossipv1.Heartbeat{ NodeName: nodeName,