diff --git a/.bedrock/.terragrunt/02_proxy_n_router_svc.tf b/.bedrock/.terragrunt/02_proxy_n_router_svc.tf index b5f3052..f3cc870 100644 --- a/.bedrock/.terragrunt/02_proxy_n_router_svc.tf +++ b/.bedrock/.terragrunt/02_proxy_n_router_svc.tf @@ -18,10 +18,7 @@ output "CI_AWS_ECR_CLUSTER_REGION" { value = var.proxy_router["create"] ? var.re # Define Service (watch for conflict with Gitlab CI/CD) resource "aws_ecs_service" "proxy_router_use1_1" { - # lifecycle { - # ignore_changes = [desired_count, task_definition] # May want to change this to kick update to prod when new task is replicated - # create_before_destroy = true - # } + lifecycle {ignore_changes = [desired_count, task_definition]} count = var.proxy_router["create"] ? 1 : 0 provider = aws.use1 name = "svc-${var.proxy_router["svc_name"]}-${substr(var.account_shortname, 8, 3)}-${var.region_shortname}" @@ -68,7 +65,7 @@ resource "aws_ecs_service" "proxy_router_use1_1" { # Define Task resource "aws_ecs_task_definition" "proxy_router_use1_1" { - # lifecycle {ignore_changes = [container_definitions]} + lifecycle {ignore_changes = [container_definitions]} count = var.proxy_router["create"] ? 1 : 0 provider = aws.use1 family = "tsk-${var.proxy_router["svc_name"]}" diff --git a/.bedrock/.terragrunt/02_proxy_n_validator_svc.tf b/.bedrock/.terragrunt/02_proxy_n_validator_svc.tf index d2df4aa..8d3d229 100644 --- a/.bedrock/.terragrunt/02_proxy_n_validator_svc.tf +++ b/.bedrock/.terragrunt/02_proxy_n_validator_svc.tf @@ -18,7 +18,7 @@ output "proxy_validator_api_target" { value = var.proxy_validator["create"] ? "u # Define Service (watch for conflict with Gitlab CI/CD) resource "aws_ecs_service" "proxy_validator_use1_1" { - # lifecycle {ignore_changes = [desired_count, task_definition] } + lifecycle {ignore_changes = [desired_count, task_definition] } count = var.proxy_validator["create"] ? 1 : 0 provider = aws.use1 name = "svc-${var.proxy_validator["svc_name"]}-${substr(var.account_shortname, 8, 3)}-${var.region_shortname}" @@ -65,9 +65,7 @@ resource "aws_ecs_service" "proxy_validator_use1_1" { # Define Task resource "aws_ecs_task_definition" "proxy_validator_use1_1" { - - # lifecycle {ignore_changes = [container_definitions]} - + lifecycle {ignore_changes = [container_definitions]} count = var.proxy_validator["create"] ? 1 : 0 provider = aws.use1 family = "tsk-${var.proxy_validator["svc_name"]}" diff --git a/internal/resources/hashrate/proxy/stratumv1_message/mining.go b/internal/resources/hashrate/proxy/stratumv1_message/mining.go index 66e63f9..46a6b35 100644 --- a/internal/resources/hashrate/proxy/stratumv1_message/mining.go +++ b/internal/resources/hashrate/proxy/stratumv1_message/mining.go @@ -51,6 +51,9 @@ func ParseStratumMessage(raw []byte) (interfaces.MiningMessageGeneric, error) { case MethodMiningSetExtranonce: return ParseMiningSetExtranonce(raw) + case MethodExtranonceSubscribe: + return ParseMiningExtranonceSubscribe(raw) + default: if msg.Result != nil { return ParseMiningResult(raw) diff --git a/internal/resources/hashrate/proxy/stratumv1_message/mining_subscribe_extnanonce.go b/internal/resources/hashrate/proxy/stratumv1_message/mining_subscribe_extnanonce.go new file mode 100644 index 0000000..5b80d46 --- /dev/null +++ b/internal/resources/hashrate/proxy/stratumv1_message/mining_subscribe_extnanonce.go @@ -0,0 +1,38 @@ +package stratumv1_message + +import ( + "encoding/json" + + "github.com/Lumerin-protocol/proxy-router/internal/resources/hashrate/proxy/interfaces" +) + +// Message: {"id":null,"method":"mining.extranonce.subscribe","params":[]} +const MethodExtranonceSubscribe = "mining.extranonce.subscribe" + +type MiningExtranonceSubscribe struct { + ID *int `json:"id"` + Method string `json:"method,omitempty"` + Params *MiningExtranonceSubscribeParams `json:"params"` +} + +type MiningExtranonceSubscribeParams = []interface{} + +func NewMiningExtranonceSubscribe(ID int) *MiningExtranonceSubscribe { + return &MiningExtranonceSubscribe{ + ID: &ID, + Method: MethodExtranonceSubscribe, + Params: &MiningExtranonceSubscribeParams{}, + } +} + +func ParseMiningExtranonceSubscribe(b []byte) (*MiningExtranonceSubscribe, error) { + m := &MiningExtranonceSubscribe{} + return m, json.Unmarshal(b, m) +} + +func (m *MiningExtranonceSubscribe) Serialize() []byte { + b, _ := json.Marshal(m) + return b +} + +var _ interfaces.MiningMessageGeneric = new(MiningExtranonceSubscribe) diff --git a/internal/resources/hashrate/proxy/stratumv1_message/mining_subscribe_extranonce_test.go b/internal/resources/hashrate/proxy/stratumv1_message/mining_subscribe_extranonce_test.go new file mode 100644 index 0000000..6387dcc --- /dev/null +++ b/internal/resources/hashrate/proxy/stratumv1_message/mining_subscribe_extranonce_test.go @@ -0,0 +1,26 @@ +package stratumv1_message + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestMiningExtranonceSubscribe(t *testing.T) { + msg := NewMiningExtranonceSubscribe(1) + b := msg.Serialize() + t.Logf("msg: %s", string(b)) + require.NotNil(t, b) + require.Equal(t, MethodExtranonceSubscribe, msg.Method) + require.Nil(t, msg.Params) +} + +func TestMiningExtranonceSubscribeParse(t *testing.T) { + msg := NewMiningExtranonceSubscribe(1) + b := msg.Serialize() + parsed, err := ParseMiningExtranonceSubscribe(b) + require.NoError(t, err) + require.Equal(t, msg.Method, parsed.Method) + require.Equal(t, msg.Params, parsed.Params) + require.Equal(t, msg.ID, parsed.ID) +}