Skip to content

Commit da5253e

Browse files
committed
cmd/loop: update static loop-in replay fixtures
Static loop-in replay sessions changed once low-confirmation warnings and payment-timeout prompts were added, and quote validation should happen before the summary request affects prompt order. The fixtures need to reflect the new CLI interaction sequence. Move the static address summary request after quote validation, add replay fixtures for static loop-in warning prompts, and refresh payment-timeout and fee replay variants.
1 parent 8f3f5f4 commit da5253e

6 files changed

Lines changed: 162 additions & 7 deletions

cmd/loop/staticaddr.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -559,13 +559,6 @@ func staticAddressLoopIn(ctx context.Context, cmd *cli.Command) error {
559559
return errors.New("no deposited outputs available")
560560
}
561561

562-
summary, err := client.GetStaticAddressSummary(
563-
ctx, &looprpc.StaticAddressSummaryRequest{},
564-
)
565-
if err != nil {
566-
return err
567-
}
568-
569562
var depositOutpoints []string
570563
switch {
571564
case isAllSelected && isUtxoSelected:
@@ -623,6 +616,13 @@ func staticAddressLoopIn(ctx context.Context, cmd *cli.Command) error {
623616
// Warn the user if any selected deposits have fewer than 6
624617
// confirmations, as the swap payment won't be received immediately
625618
// for those.
619+
summary, err := client.GetStaticAddressSummary(
620+
ctx, &looprpc.StaticAddressSummaryRequest{},
621+
)
622+
if err != nil {
623+
return err
624+
}
625+
626626
depositsToCheck := warningDepositOutpoints(
627627
allDeposits, depositOutpoints, autoSelectDepositsForQuote,
628628
quoteReq.Amt,

cmd/loop/testdata/sessions/static-loop-in/15_loop-static-in.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,37 @@
9191
}
9292
}
9393
},
94+
{
95+
"time_ms": 65,
96+
"kind": "grpc",
97+
"data": {
98+
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
99+
"event": "request",
100+
"message_type": "looprpc.StaticAddressSummaryRequest",
101+
"payload": {}
102+
}
103+
},
104+
{
105+
"time_ms": 65,
106+
"kind": "grpc",
107+
"data": {
108+
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
109+
"event": "response",
110+
"message_type": "looprpc.StaticAddressSummaryResponse",
111+
"payload": {
112+
"static_address": "bcrt1pfu9g59aqtxd39653f76y4c8z7r3t9tmcvrvhl57a3dgj3epdwxdqcd9fpw",
113+
"relative_expiry_blocks": "14400",
114+
"total_num_deposits": 1,
115+
"value_unconfirmed_satoshis": "0",
116+
"value_deposited_satoshis": "2500000",
117+
"value_expired_satoshis": "0",
118+
"value_withdrawn_satoshis": "0",
119+
"value_looped_in_satoshis": "0",
120+
"value_htlc_timeout_sweeps_satoshis": "0",
121+
"value_channels_opened": "0"
122+
}
123+
}
124+
},
94125
{
95126
"time_ms": 65,
96127
"kind": "stdout",

cmd/loop/testdata/sessions/static-loop-in/18_loop-static-in-positional-payment-timeout.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,37 @@
9494
}
9595
}
9696
},
97+
{
98+
"time_ms": 500,
99+
"kind": "grpc",
100+
"data": {
101+
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
102+
"event": "request",
103+
"message_type": "looprpc.StaticAddressSummaryRequest",
104+
"payload": {}
105+
}
106+
},
107+
{
108+
"time_ms": 500,
109+
"kind": "grpc",
110+
"data": {
111+
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
112+
"event": "response",
113+
"message_type": "looprpc.StaticAddressSummaryResponse",
114+
"payload": {
115+
"static_address": "bcrt1pfu9g59aqtxd39653f76y4c8z7r3t9tmcvrvhl57a3dgj3epdwxdqcd9fpw",
116+
"relative_expiry_blocks": "14400",
117+
"total_num_deposits": 1,
118+
"value_unconfirmed_satoshis": "0",
119+
"value_deposited_satoshis": "500000",
120+
"value_expired_satoshis": "0",
121+
"value_withdrawn_satoshis": "0",
122+
"value_looped_in_satoshis": "0",
123+
"value_htlc_timeout_sweeps_satoshis": "0",
124+
"value_channels_opened": "0"
125+
}
126+
}
127+
},
97128
{
98129
"time_ms": 500,
99130
"kind": "grpc",

cmd/loop/testdata/sessions/static-loop-in/19_loop-static-in-all-cancel.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,37 @@
9999
}
100100
}
101101
},
102+
{
103+
"time_ms": 446,
104+
"kind": "grpc",
105+
"data": {
106+
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
107+
"event": "request",
108+
"message_type": "looprpc.StaticAddressSummaryRequest",
109+
"payload": {}
110+
}
111+
},
112+
{
113+
"time_ms": 446,
114+
"kind": "grpc",
115+
"data": {
116+
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
117+
"event": "response",
118+
"message_type": "looprpc.StaticAddressSummaryResponse",
119+
"payload": {
120+
"static_address": "bcrt1pfu9g59aqtxd39653f76y4c8z7r3t9tmcvrvhl57a3dgj3epdwxdqcd9fpw",
121+
"relative_expiry_blocks": "14400",
122+
"total_num_deposits": 1,
123+
"value_unconfirmed_satoshis": "0",
124+
"value_deposited_satoshis": "500000",
125+
"value_expired_satoshis": "0",
126+
"value_withdrawn_satoshis": "0",
127+
"value_looped_in_satoshis": "0",
128+
"value_htlc_timeout_sweeps_satoshis": "0",
129+
"value_channels_opened": "0"
130+
}
131+
}
132+
},
102133
{
103134
"time_ms": 446,
104135
"kind": "stdout",

cmd/loop/testdata/sessions/static-loop-in/23_loop-static-in-max-swap-fee-both.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,37 @@
127127
}
128128
}
129129
},
130+
{
131+
"time_ms": 50,
132+
"kind": "grpc",
133+
"data": {
134+
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
135+
"event": "request",
136+
"message_type": "looprpc.StaticAddressSummaryRequest",
137+
"payload": {}
138+
}
139+
},
140+
{
141+
"time_ms": 50,
142+
"kind": "grpc",
143+
"data": {
144+
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
145+
"event": "response",
146+
"message_type": "looprpc.StaticAddressSummaryResponse",
147+
"payload": {
148+
"static_address": "bcrt1p604kzzh28764kkw45yps48weergwljggamhhe7tqfglzjzang6cs43f2m2",
149+
"relative_expiry_blocks": "14400",
150+
"total_num_deposits": 4,
151+
"value_unconfirmed_satoshis": "0",
152+
"value_deposited_satoshis": "2546150",
153+
"value_expired_satoshis": "0",
154+
"value_withdrawn_satoshis": "0",
155+
"value_looped_in_satoshis": "0",
156+
"value_htlc_timeout_sweeps_satoshis": "0",
157+
"value_channels_opened": "0"
158+
}
159+
}
160+
},
130161
{
131162
"time_ms": 50,
132163
"kind": "grpc",

cmd/loop/testdata/sessions/static-loop-in/24_loop-static-in-max-swap-fee-sat-success.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,37 @@
118118
}
119119
}
120120
},
121+
{
122+
"time_ms": 45,
123+
"kind": "grpc",
124+
"data": {
125+
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
126+
"event": "request",
127+
"message_type": "looprpc.StaticAddressSummaryRequest",
128+
"payload": {}
129+
}
130+
},
131+
{
132+
"time_ms": 45,
133+
"kind": "grpc",
134+
"data": {
135+
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
136+
"event": "response",
137+
"message_type": "looprpc.StaticAddressSummaryResponse",
138+
"payload": {
139+
"static_address": "bcrt1p604kzzh28764kkw45yps48weergwljggamhhe7tqfglzjzang6cs43f2m2",
140+
"relative_expiry_blocks": "14400",
141+
"total_num_deposits": 3,
142+
"value_unconfirmed_satoshis": "0",
143+
"value_deposited_satoshis": "2046150",
144+
"value_expired_satoshis": "0",
145+
"value_withdrawn_satoshis": "0",
146+
"value_looped_in_satoshis": "0",
147+
"value_htlc_timeout_sweeps_satoshis": "0",
148+
"value_channels_opened": "0"
149+
}
150+
}
151+
},
121152
{
122153
"time_ms": 45,
123154
"kind": "grpc",

0 commit comments

Comments
 (0)