Skip to content

Commit

Permalink
feat: support force_min_change_sats
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Dec 6, 2023
1 parent c673ea5 commit 52579d4
Show file tree
Hide file tree
Showing 9 changed files with 630 additions and 579 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ HOSTNAME=galoymoney
PROTO_DIR := proto/vendor
PROTO_OUTPUT_DIR := bria/proto

version = 0.0.12
version = 0.0.13
os_arch = $(shell go env GOOS)_$(shell go env GOARCH)
provider_path = registry.terraform.io/galoymoney/bria/$(version)/$(os_arch)/

Expand Down
1,168 changes: 597 additions & 571 deletions bria/proto/api/bria.pb.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bria/proto/api/bria_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/resources/payout_queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ Optional:

- `cpfp_payouts_after_blocks` (Number)
- `cpfp_payouts_after_mins` (Number)
- `force_min_change_sats` (Number)


5 changes: 3 additions & 2 deletions example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ terraform {
}
bria = {
source = "galoymoney/bria"
version = "0.0.12"
version = "0.0.13"
}
}
}
Expand Down Expand Up @@ -108,13 +108,14 @@ EOT

resource "bria_payout_queue" "interval" {
name = "interval-${random_string.postfix.result}"
description = "An example Bria batch group"
description = "An example Bria payout queue"

config {
tx_priority = "NEXT_BLOCK"
consolidate_deprecated_keychains = false
interval_secs = 3600
cpfp_payouts_after_blocks = 2
cpfp_payouts_after_mins = 30
force_min_change_sats = 100000
}
}
2 changes: 2 additions & 0 deletions proto/vendor/api/bria.proto
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ message PayoutQueueConfig {
}
optional uint32 cpfp_payouts_after_mins = 6;
optional uint32 cpfp_payouts_after_blocks = 7;
optional uint64 force_min_change_sats = 8;
}

enum TxPriority {
Expand Down Expand Up @@ -383,6 +384,7 @@ message Payout {
bool cancelled = 9;
string external_id = 7;
optional google.protobuf.Struct metadata = 8;
optional uint32 batch_inclusion_estimated_at = 11;
}

message ListPayoutsResponse {
Expand Down
22 changes: 22 additions & 0 deletions provider/payout_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ func resourcePayoutQueue() *schema.Resource {
Optional: true,
Default: -1,
},
"force_min_change_sats": {
Type: schema.TypeInt,
Optional: true,
Default: -1,
},
},
},
},
Expand Down Expand Up @@ -85,6 +90,12 @@ func resourcePayoutQueueCreate(d *schema.ResourceData, m interface{}) error {
config.CpfpPayoutsAfterBlocks = &tempVal
}
}
if val, ok := configData["force_min_change_sats"]; ok {
if val.(int) >= 0 {
tempVal := uint64(val.(int))
config.ForceMinChangeSats = &tempVal
}
}

res, err := client.CreatePayoutQueue(name, description, config)
if err != nil {
Expand Down Expand Up @@ -136,6 +147,11 @@ func resourcePayoutQueueRead(d *schema.ResourceData, meta interface{}) error {
} else {
config["cpfp_payouts_after_blocks"] = -1
}
if queue.Config.ForceMinChangeSats != nil {
config["force_min_change_sats"] = *queue.Config.ForceMinChangeSats
} else {
config["force_min_change_sats"] = -1
}

if err := d.Set("config", []interface{}{config}); err != nil {
return fmt.Errorf("error setting config: %w", err)
Expand Down Expand Up @@ -171,6 +187,12 @@ func resourcePayoutQueueUpdate(d *schema.ResourceData, m interface{}) error {
config.CpfpPayoutsAfterBlocks = &tempVal
}
}
if val, ok := configData["force_min_change_sats"]; ok {
if val.(int) >= 0 {
tempVal := uint64(val.(int))
config.ForceMinChangeSats = &tempVal
}
}

_, err := client.UpdatePayoutQueue(queueId, description, config)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions vendir.lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ apiVersion: vendir.k14s.io/v1alpha1
directories:
- contents:
- git:
commitTitle: 'ci(release): release version 0.1.71'
sha: 3d632024e23715842a889b5f0427a9a0f076f39c
commitTitle: 'ci(release): release version 0.1.78'
sha: 23ae5997ffc7ff5a266e798cc5938aa6b9259c84
tags:
- 0.1.71
- 0.1.78
path: vendor
path: ./proto
kind: LockConfig
2 changes: 1 addition & 1 deletion vendir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ directories:
- path: vendor
git:
url: https://github.com/GaloyMoney/bria.git
ref: 0.1.71
ref: 0.1.78
includePaths:
- proto/**/*
newRootPath: proto

0 comments on commit 52579d4

Please sign in to comment.