mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
looprpc: extend client.proto with lnrpc.OutPoint and lnrpc.OpenChannelRequest
In this commit we import the lnd's lightning.proto into client.proto to then be able to use lnrpc.OutPoint and lnrpc.OpenChannelRequest instead of the looprpc.OutPoint type. This is safe because the lnrpc and looprpc versions of OutPoint are the same type.
This commit is contained in:
parent
6aaacf8b93
commit
f47b611557
7 changed files with 1002 additions and 584 deletions
|
|
@ -32,6 +32,7 @@ import (
|
|||
"github.com/lightninglabs/loop/staticaddr/address"
|
||||
"github.com/lightninglabs/loop/staticaddr/deposit"
|
||||
"github.com/lightninglabs/loop/staticaddr/loopin"
|
||||
"github.com/lightninglabs/loop/staticaddr/staticutil"
|
||||
"github.com/lightninglabs/loop/staticaddr/withdraw"
|
||||
"github.com/lightninglabs/loop/swap"
|
||||
"github.com/lightninglabs/loop/swapserverrpc"
|
||||
|
|
@ -1763,7 +1764,7 @@ func (s *swapClientServer) WithdrawDeposits(ctx context.Context,
|
|||
}
|
||||
|
||||
case isUtxoSelected:
|
||||
outpoints, err = toServerOutpoints(req.Outpoints)
|
||||
outpoints, err = staticutil.ToWireOutpoints(req.Outpoints)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -2328,23 +2329,6 @@ func toServerState(state looprpc.DepositState) fsm.StateType {
|
|||
}
|
||||
}
|
||||
|
||||
func toServerOutpoints(outpoints []*looprpc.OutPoint) ([]wire.OutPoint,
|
||||
error) {
|
||||
|
||||
var serverOutpoints []wire.OutPoint
|
||||
for _, o := range outpoints {
|
||||
outpointStr := fmt.Sprintf("%s:%d", o.TxidStr, o.OutputIndex)
|
||||
newOutpoint, err := wire.NewOutPointFromString(outpointStr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
serverOutpoints = append(serverOutpoints, *newOutpoint)
|
||||
}
|
||||
|
||||
return serverOutpoints, nil
|
||||
}
|
||||
|
||||
func rpcAutoloopReason(reason liquidity.Reason) (looprpc.AutoReason, error) {
|
||||
switch reason {
|
||||
case liquidity.ReasonNone:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue