mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
cmd/loop: update static loop-in replay flow
Delay the static address summary RPC until after validation and quote fee checks. This keeps early error paths on their previous gRPC flow. Add summary RPC events to the static loop-in sessions that reach the confirmation prompt or swap dispatch, where the CLI needs the expiry horizon for low-confirmation warnings.
This commit is contained in:
parent
ec42d48aac
commit
978a2cbe05
6 changed files with 162 additions and 7 deletions
|
|
@ -559,13 +559,6 @@ func staticAddressLoopIn(ctx context.Context, cmd *cli.Command) error {
|
|||
return errors.New("no deposited outputs available")
|
||||
}
|
||||
|
||||
summary, err := client.GetStaticAddressSummary(
|
||||
ctx, &looprpc.StaticAddressSummaryRequest{},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var depositOutpoints []string
|
||||
switch {
|
||||
case isAllSelected && isUtxoSelected:
|
||||
|
|
@ -623,6 +616,13 @@ func staticAddressLoopIn(ctx context.Context, cmd *cli.Command) error {
|
|||
// Warn the user if any selected deposits have fewer than 6
|
||||
// confirmations, as the swap payment won't be received immediately
|
||||
// for those.
|
||||
summary, err := client.GetStaticAddressSummary(
|
||||
ctx, &looprpc.StaticAddressSummaryRequest{},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
depositsToCheck := warningDepositOutpoints(
|
||||
allDeposits, depositOutpoints, autoSelectDepositsForQuote,
|
||||
quoteReq.Amt,
|
||||
|
|
|
|||
|
|
@ -91,6 +91,37 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 65,
|
||||
"kind": "grpc",
|
||||
"data": {
|
||||
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
|
||||
"event": "request",
|
||||
"message_type": "looprpc.StaticAddressSummaryRequest",
|
||||
"payload": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 65,
|
||||
"kind": "grpc",
|
||||
"data": {
|
||||
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
|
||||
"event": "response",
|
||||
"message_type": "looprpc.StaticAddressSummaryResponse",
|
||||
"payload": {
|
||||
"static_address": "bcrt1pfu9g59aqtxd39653f76y4c8z7r3t9tmcvrvhl57a3dgj3epdwxdqcd9fpw",
|
||||
"relative_expiry_blocks": "14400",
|
||||
"total_num_deposits": 1,
|
||||
"value_unconfirmed_satoshis": "0",
|
||||
"value_deposited_satoshis": "2500000",
|
||||
"value_expired_satoshis": "0",
|
||||
"value_withdrawn_satoshis": "0",
|
||||
"value_looped_in_satoshis": "0",
|
||||
"value_htlc_timeout_sweeps_satoshis": "0",
|
||||
"value_channels_opened": "0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 65,
|
||||
"kind": "stdout",
|
||||
|
|
|
|||
|
|
@ -94,6 +94,37 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 500,
|
||||
"kind": "grpc",
|
||||
"data": {
|
||||
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
|
||||
"event": "request",
|
||||
"message_type": "looprpc.StaticAddressSummaryRequest",
|
||||
"payload": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 500,
|
||||
"kind": "grpc",
|
||||
"data": {
|
||||
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
|
||||
"event": "response",
|
||||
"message_type": "looprpc.StaticAddressSummaryResponse",
|
||||
"payload": {
|
||||
"static_address": "bcrt1pfu9g59aqtxd39653f76y4c8z7r3t9tmcvrvhl57a3dgj3epdwxdqcd9fpw",
|
||||
"relative_expiry_blocks": "14400",
|
||||
"total_num_deposits": 1,
|
||||
"value_unconfirmed_satoshis": "0",
|
||||
"value_deposited_satoshis": "500000",
|
||||
"value_expired_satoshis": "0",
|
||||
"value_withdrawn_satoshis": "0",
|
||||
"value_looped_in_satoshis": "0",
|
||||
"value_htlc_timeout_sweeps_satoshis": "0",
|
||||
"value_channels_opened": "0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 500,
|
||||
"kind": "grpc",
|
||||
|
|
|
|||
|
|
@ -99,6 +99,37 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 446,
|
||||
"kind": "grpc",
|
||||
"data": {
|
||||
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
|
||||
"event": "request",
|
||||
"message_type": "looprpc.StaticAddressSummaryRequest",
|
||||
"payload": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 446,
|
||||
"kind": "grpc",
|
||||
"data": {
|
||||
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
|
||||
"event": "response",
|
||||
"message_type": "looprpc.StaticAddressSummaryResponse",
|
||||
"payload": {
|
||||
"static_address": "bcrt1pfu9g59aqtxd39653f76y4c8z7r3t9tmcvrvhl57a3dgj3epdwxdqcd9fpw",
|
||||
"relative_expiry_blocks": "14400",
|
||||
"total_num_deposits": 1,
|
||||
"value_unconfirmed_satoshis": "0",
|
||||
"value_deposited_satoshis": "500000",
|
||||
"value_expired_satoshis": "0",
|
||||
"value_withdrawn_satoshis": "0",
|
||||
"value_looped_in_satoshis": "0",
|
||||
"value_htlc_timeout_sweeps_satoshis": "0",
|
||||
"value_channels_opened": "0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 446,
|
||||
"kind": "stdout",
|
||||
|
|
|
|||
|
|
@ -127,6 +127,37 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 50,
|
||||
"kind": "grpc",
|
||||
"data": {
|
||||
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
|
||||
"event": "request",
|
||||
"message_type": "looprpc.StaticAddressSummaryRequest",
|
||||
"payload": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 50,
|
||||
"kind": "grpc",
|
||||
"data": {
|
||||
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
|
||||
"event": "response",
|
||||
"message_type": "looprpc.StaticAddressSummaryResponse",
|
||||
"payload": {
|
||||
"static_address": "bcrt1p604kzzh28764kkw45yps48weergwljggamhhe7tqfglzjzang6cs43f2m2",
|
||||
"relative_expiry_blocks": "14400",
|
||||
"total_num_deposits": 4,
|
||||
"value_unconfirmed_satoshis": "0",
|
||||
"value_deposited_satoshis": "2546150",
|
||||
"value_expired_satoshis": "0",
|
||||
"value_withdrawn_satoshis": "0",
|
||||
"value_looped_in_satoshis": "0",
|
||||
"value_htlc_timeout_sweeps_satoshis": "0",
|
||||
"value_channels_opened": "0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 50,
|
||||
"kind": "grpc",
|
||||
|
|
|
|||
|
|
@ -118,6 +118,37 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 45,
|
||||
"kind": "grpc",
|
||||
"data": {
|
||||
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
|
||||
"event": "request",
|
||||
"message_type": "looprpc.StaticAddressSummaryRequest",
|
||||
"payload": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 45,
|
||||
"kind": "grpc",
|
||||
"data": {
|
||||
"method": "/looprpc.SwapClient/GetStaticAddressSummary",
|
||||
"event": "response",
|
||||
"message_type": "looprpc.StaticAddressSummaryResponse",
|
||||
"payload": {
|
||||
"static_address": "bcrt1p604kzzh28764kkw45yps48weergwljggamhhe7tqfglzjzang6cs43f2m2",
|
||||
"relative_expiry_blocks": "14400",
|
||||
"total_num_deposits": 3,
|
||||
"value_unconfirmed_satoshis": "0",
|
||||
"value_deposited_satoshis": "2046150",
|
||||
"value_expired_satoshis": "0",
|
||||
"value_withdrawn_satoshis": "0",
|
||||
"value_looped_in_satoshis": "0",
|
||||
"value_htlc_timeout_sweeps_satoshis": "0",
|
||||
"value_channels_opened": "0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"time_ms": 45,
|
||||
"kind": "grpc",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue