Merge pull request #184 from bhandras/native-segwit

support for native segwit loop-in
pull/196/head
Joost Jager 4 years ago committed by GitHub
commit 33a049f8e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -194,17 +194,17 @@ func (s *Client) FetchSwaps() ([]*SwapInfo, error) {
}
swaps = append(swaps, &SwapInfo{
SwapType: swap.TypeOut,
SwapContract: swp.Contract.SwapContract,
SwapStateData: swp.State(),
SwapHash: swp.Hash,
LastUpdate: swp.LastUpdateTime(),
HtlcAddress: htlc.Address,
SwapType: swap.TypeOut,
SwapContract: swp.Contract.SwapContract,
SwapStateData: swp.State(),
SwapHash: swp.Hash,
LastUpdate: swp.LastUpdateTime(),
HtlcAddressP2WSH: htlc.Address,
})
}
for _, swp := range loopInSwaps {
htlc, err := swap.NewHtlc(
htlcNP2WSH, err := swap.NewHtlc(
swp.Contract.CltvExpiry, swp.Contract.SenderKey,
swp.Contract.ReceiverKey, swp.Hash, swap.HtlcNP2WSH,
s.lndServices.ChainParams,
@ -213,13 +213,23 @@ func (s *Client) FetchSwaps() ([]*SwapInfo, error) {
return nil, err
}
htlcP2WSH, err := swap.NewHtlc(
swp.Contract.CltvExpiry, swp.Contract.SenderKey,
swp.Contract.ReceiverKey, swp.Hash, swap.HtlcP2WSH,
s.lndServices.ChainParams,
)
if err != nil {
return nil, err
}
swaps = append(swaps, &SwapInfo{
SwapType: swap.TypeIn,
SwapContract: swp.Contract.SwapContract,
SwapStateData: swp.State(),
SwapHash: swp.Hash,
LastUpdate: swp.LastUpdateTime(),
HtlcAddress: htlc.Address,
SwapType: swap.TypeIn,
SwapContract: swp.Contract.SwapContract,
SwapStateData: swp.State(),
SwapHash: swp.Hash,
LastUpdate: swp.LastUpdateTime(),
HtlcAddressP2WSH: htlcP2WSH.Address,
HtlcAddressNP2WSH: htlcNP2WSH.Address,
})
}
@ -464,7 +474,7 @@ func (s *Client) waitForInitialized(ctx context.Context) error {
// LoopIn initiates a loop in swap.
func (s *Client) LoopIn(globalCtx context.Context,
request *LoopInRequest) (*lntypes.Hash, btcutil.Address, error) {
request *LoopInRequest) (*LoopInSwapInfo, error) {
log.Infof("Loop in %v (last hop: %v)",
request.Amount,
@ -472,7 +482,7 @@ func (s *Client) LoopIn(globalCtx context.Context,
)
if err := s.waitForInitialized(globalCtx); err != nil {
return nil, nil, err
return nil, err
}
// Create a new swap object for this swap.
@ -486,7 +496,7 @@ func (s *Client) LoopIn(globalCtx context.Context,
globalCtx, &swapCfg, initiationHeight, request,
)
if err != nil {
return nil, nil, err
return nil, err
}
// Post swap to the main loop.
@ -494,7 +504,12 @@ func (s *Client) LoopIn(globalCtx context.Context,
// Return hash so that the caller can identify this swap in the updates
// stream.
return &swap.hash, swap.htlc.Address, nil
swapInfo := &LoopInSwapInfo{
SwapHash: swap.hash,
HtlcAddressP2WSH: swap.htlcP2WSH.Address,
HtlcAddressNP2WSH: swap.htlcNP2WSH.Address,
}
return swapInfo, nil
}
// LoopInQuote takes an amount and returns a break down of estimated

@ -153,7 +153,10 @@ func loopIn(ctx *cli.Context) error {
fmt.Printf("Swap initiated\n")
fmt.Printf("ID: %v\n", resp.Id)
fmt.Printf("HTLC address: %v\n", resp.HtlcAddress)
if external {
fmt.Printf("HTLC address (NP2WSH): %v\n", resp.HtlcAddressNp2Wsh)
}
fmt.Printf("HTLC address (P2WSH): %v\n", resp.HtlcAddressP2Wsh)
fmt.Println()
fmt.Printf("Run `loop monitor` to monitor progress.\n")

@ -225,11 +225,24 @@ func parseAmt(text string) (btcutil.Amount, error) {
}
func logSwap(swap *looprpc.SwapStatus) {
fmt.Printf("%v %v %v %v - %v",
time.Unix(0, swap.LastUpdateTime).Format(time.RFC3339),
swap.Type, swap.State, btcutil.Amount(swap.Amt),
swap.HtlcAddress,
)
if swap.Type == looprpc.SwapType_LOOP_OUT {
fmt.Printf("%v %v %v %v - %v",
time.Unix(0, swap.LastUpdateTime).Format(time.RFC3339),
swap.Type, swap.State, btcutil.Amount(swap.Amt),
swap.HtlcAddressP2Wsh,
)
} else {
fmt.Printf("%v %v %v %v -",
time.Unix(0, swap.LastUpdateTime).Format(time.RFC3339),
swap.Type, swap.State, btcutil.Amount(swap.Amt))
if swap.HtlcAddressP2Wsh != "" {
fmt.Printf(" P2WSH: %v", swap.HtlcAddressP2Wsh)
}
if swap.HtlcAddressNp2Wsh != "" {
fmt.Printf(" NP2WSH: %v", swap.HtlcAddressNp2Wsh)
}
}
if swap.State != looprpc.SwapState_INITIATED &&
swap.State != looprpc.SwapState_HTLC_PUBLISHED &&

@ -235,6 +235,21 @@ type LoopInQuote struct {
CltvDelta int32
}
// LoopInSwapInfo contains essential information of a loop-in swap after the
// swap is initiated.
type LoopInSwapInfo struct { // nolint
// SwapHash contains the sha256 hash of the swap preimage.
SwapHash lntypes.Hash
// HtlcAddressP2WSH contains the native segwit swap htlc address,
// where the loop-in funds may be paid.
HtlcAddressP2WSH btcutil.Address
// HtlcAddressNP2WSH contains the nested segwit swap htlc address,
// where the loop-in funds may be paid.
HtlcAddressNP2WSH btcutil.Address
}
// SwapInfoKit contains common swap info fields.
type SwapInfoKit struct {
// Hash is the sha256 hash of the preimage that unlocks the htlcs. It
@ -249,15 +264,27 @@ type SwapInfoKit struct {
type SwapInfo struct {
loopdb.SwapStateData
loopdb.SwapContract
// LastUpdateTime is the time of the last state change.
LastUpdate time.Time
// SwapHash stores the swap preimage hash.
SwapHash lntypes.Hash
// SwapType describes whether this is a loop in or loop out swap.
SwapType swap.Type
loopdb.SwapContract
// HtlcAddressP2WSH stores the address of the P2WSH (native segwit)
// swap htlc. This is used for both loop-in and loop-out.
HtlcAddressP2WSH btcutil.Address
HtlcAddress btcutil.Address
// HtlcAddressNP2WSH stores the address of the NP2WSH (nested segwit)
// swap htlc. This is only used for external loop-in.
HtlcAddressNP2WSH btcutil.Address
// ExternalHtlc is set to true for external loop-in swaps.
ExternalHtlc bool
}
// LastUpdate returns the last update time of the swap

@ -126,27 +126,43 @@ func (s *swapClientServer) marshallSwap(loopSwap *loop.SwapInfo) (
}
var swapType looprpc.SwapType
var htlcAddress, htlcAddressP2WSH, htlcAddressNP2WSH string
switch loopSwap.SwapType {
case swap.TypeIn:
swapType = looprpc.SwapType_LOOP_IN
htlcAddressP2WSH = loopSwap.HtlcAddressP2WSH.EncodeAddress()
if loopSwap.ExternalHtlc {
htlcAddressNP2WSH = loopSwap.HtlcAddressNP2WSH.EncodeAddress()
htlcAddress = htlcAddressNP2WSH
} else {
htlcAddress = htlcAddressP2WSH
}
case swap.TypeOut:
swapType = looprpc.SwapType_LOOP_OUT
htlcAddressP2WSH = loopSwap.HtlcAddressP2WSH.EncodeAddress()
htlcAddress = htlcAddressP2WSH
default:
return nil, errors.New("unknown swap type")
}
return &looprpc.SwapStatus{
Amt: int64(loopSwap.AmountRequested),
Id: loopSwap.SwapHash.String(),
IdBytes: loopSwap.SwapHash[:],
State: state,
InitiationTime: loopSwap.InitiationTime.UnixNano(),
LastUpdateTime: loopSwap.LastUpdate.UnixNano(),
HtlcAddress: loopSwap.HtlcAddress.EncodeAddress(),
Type: swapType,
CostServer: int64(loopSwap.Cost.Server),
CostOnchain: int64(loopSwap.Cost.Onchain),
CostOffchain: int64(loopSwap.Cost.Offchain),
Amt: int64(loopSwap.AmountRequested),
Id: loopSwap.SwapHash.String(),
IdBytes: loopSwap.SwapHash[:],
State: state,
InitiationTime: loopSwap.InitiationTime.UnixNano(),
LastUpdateTime: loopSwap.LastUpdate.UnixNano(),
HtlcAddress: htlcAddress,
HtlcAddressP2Wsh: htlcAddressP2WSH,
HtlcAddressNp2Wsh: htlcAddressNP2WSH,
Type: swapType,
CostServer: int64(loopSwap.Cost.Server),
CostOnchain: int64(loopSwap.Cost.Onchain),
CostOffchain: int64(loopSwap.Cost.Offchain),
}, nil
}
@ -255,6 +271,9 @@ func (s *swapClientServer) ListSwaps(_ context.Context,
err error
)
s.swapsLock.Lock()
defer s.swapsLock.Unlock()
// We can just use the server's in-memory cache as that contains the
// most up-to-date state including temporary failures which aren't
// persisted to disk. The swaps field is a map, that's why we need an
@ -409,17 +428,25 @@ func (s *swapClientServer) LoopIn(ctx context.Context,
}
req.LastHop = &lastHop
}
hash, htlc, err := s.impl.LoopIn(ctx, req)
swapInfo, err := s.impl.LoopIn(ctx, req)
if err != nil {
log.Errorf("Loop in: %v", err)
return nil, err
}
return &looprpc.SwapResponse{
Id: hash.String(),
IdBytes: hash[:],
HtlcAddress: htlc.String(),
}, nil
np2wshAddress := swapInfo.HtlcAddressNP2WSH.String()
response := &looprpc.SwapResponse{
Id: swapInfo.SwapHash.String(),
IdBytes: swapInfo.SwapHash[:],
HtlcAddress: np2wshAddress,
HtlcAddressNp2Wsh: np2wshAddress,
}
if req.ExternalHtlc {
response.HtlcAddressP2Wsh = swapInfo.HtlcAddressP2WSH.String()
}
return response, nil
}
// GetLsatTokens returns all tokens that are contained in the LSAT token store.

@ -48,8 +48,16 @@ var (
type loopInSwap struct {
swapKit
executeConfig
loopdb.LoopInContract
htlc *swap.Htlc
htlcP2WSH *swap.Htlc
htlcNP2WSH *swap.Htlc
timeoutAddr btcutil.Address
}
@ -148,13 +156,9 @@ func newLoopInSwap(globalCtx context.Context, cfg *swapConfig,
},
}
swapKit, err := newSwapKit(
swapKit := newSwapKit(
swapHash, swap.TypeIn, cfg, &contract.SwapContract,
swap.HtlcNP2WSH,
)
if err != nil {
return nil, err
}
swapKit.lastUpdateTime = initiationTime
@ -163,6 +167,10 @@ func newLoopInSwap(globalCtx context.Context, cfg *swapConfig,
swapKit: *swapKit,
}
if err := swap.initHtlcs(); err != nil {
return nil, err
}
// Persist the data before exiting this function, so that the caller can
// trust that this swap will be resumed on restart.
err = cfg.store.CreateLoopIn(swapHash, &swap.LoopInContract)
@ -182,19 +190,19 @@ func resumeLoopInSwap(reqContext context.Context, cfg *swapConfig,
log.Infof("Resuming loop in swap %v", hash)
swapKit, err := newSwapKit(
swapKit := newSwapKit(
hash, swap.TypeIn, cfg, &pend.Contract.SwapContract,
swap.HtlcNP2WSH,
)
if err != nil {
return nil, err
}
swap := &loopInSwap{
LoopInContract: *pend.Contract,
swapKit: *swapKit,
}
if err := swap.initHtlcs(); err != nil {
return nil, err
}
lastUpdate := pend.LastUpdate()
if lastUpdate == nil {
swap.lastUpdateTime = pend.Contract.InitiationTime
@ -222,6 +230,47 @@ func validateLoopInContract(lnd *lndclient.LndServices,
return nil
}
// initHtlcs creates and updates the native and nested segwit htlcs
// of the loopInSwap.
func (s *loopInSwap) initHtlcs() error {
htlcP2WSH, err := s.swapKit.getHtlc(swap.HtlcP2WSH)
if err != nil {
return err
}
htlcNP2WSH, err := s.swapKit.getHtlc(swap.HtlcNP2WSH)
if err != nil {
return err
}
// Log htlc addresses for debugging.
s.swapKit.log.Infof("Htlc address (P2WSH): %v", htlcP2WSH.Address)
s.swapKit.log.Infof("Htlc address (NP2WSH): %v", htlcNP2WSH.Address)
s.htlcP2WSH = htlcP2WSH
s.htlcNP2WSH = htlcNP2WSH
return nil
}
// sendUpdate reports an update to the swap state.
func (s *loopInSwap) sendUpdate(ctx context.Context) error {
info := s.swapInfo()
s.log.Infof("Loop in swap state: %v", info.State)
info.HtlcAddressP2WSH = s.htlcP2WSH.Address
info.HtlcAddressNP2WSH = s.htlcNP2WSH.Address
info.ExternalHtlc = s.ExternalHtlc
select {
case s.statusChan <- *info:
case <-ctx.Done():
return ctx.Err()
}
return nil
}
// execute starts/resumes the swap. It is a thin wrapper around executeSwap to
// conveniently handle the error case.
func (s *loopInSwap) execute(mainCtx context.Context,
@ -340,21 +389,44 @@ func (s *loopInSwap) waitForHtlcConf(globalCtx context.Context) (
ctx, cancel := context.WithCancel(globalCtx)
defer cancel()
confChan, confErr, err := s.lnd.ChainNotifier.RegisterConfirmationsNtfn(
ctx, nil, s.htlc.PkScript, 1, s.InitiationHeight,
notifier := s.lnd.ChainNotifier
confChanP2WSH, confErrP2WSH, err := notifier.RegisterConfirmationsNtfn(
ctx, nil, s.htlcP2WSH.PkScript, 1, s.InitiationHeight,
)
if err != nil {
return nil, err
}
confChanNP2WSH, confErrNP2WSH, err := notifier.RegisterConfirmationsNtfn(
ctx, nil, s.htlcNP2WSH.PkScript, 1, s.InitiationHeight,
)
if err != nil {
return nil, err
}
for {
select {
// Htlc confirmed.
case conf := <-confChan:
// P2WSH htlc confirmed.
case conf := <-confChanP2WSH:
s.htlc = s.htlcP2WSH
s.log.Infof("P2WSH htlc confirmed")
return conf, nil
// NP2WSH htlc confirmed.
case conf := <-confChanNP2WSH:
s.htlc = s.htlcNP2WSH
s.log.Infof("NP2WSH htlc confirmed")
return conf, nil
// Conf ntfn error.
case err := <-confErrP2WSH:
return nil, err
// Conf ntfn error.
case err := <-confErr:
case err := <-confErrNP2WSH:
return nil, err
// Keep up with block height.
@ -399,9 +471,11 @@ func (s *loopInSwap) publishOnChainHtlc(ctx context.Context) (bool, error) {
}
s.log.Infof("Publishing on chain HTLC with fee rate %v", feeRate)
// Internal loop-in is always P2WSH.
tx, err := s.lnd.WalletKit.SendOutputs(ctx,
[]*wire.TxOut{{
PkScript: s.htlc.PkScript,
PkScript: s.htlcP2WSH.PkScript,
Value: int64(s.LoopInContract.AmountRequested),
}},
feeRate,

@ -67,6 +67,7 @@ func TestLoopInSuccess(t *testing.T) {
// Expect register for htlc conf.
<-ctx.lnd.RegisterConfChannel
<-ctx.lnd.RegisterConfChannel
// Confirm htlc.
ctx.lnd.ConfChannel <- &chainntnfs.TxConfirmation{
@ -118,20 +119,32 @@ func TestLoopInSuccess(t *testing.T) {
func TestLoopInTimeout(t *testing.T) {
testAmt := int64(testLoopInRequest.Amount)
t.Run("internal htlc", func(t *testing.T) {
testLoopInTimeout(t, 0)
})
t.Run("external htlc", func(t *testing.T) {
testLoopInTimeout(t, testAmt)
})
t.Run("external amount too high", func(t *testing.T) {
testLoopInTimeout(t, testAmt+1)
})
t.Run("external amount too low", func(t *testing.T) {
testLoopInTimeout(t, testAmt-1)
testLoopInTimeout(t, swap.HtlcP2WSH, 0)
})
outputTypes := []swap.HtlcOutputType{swap.HtlcP2WSH, swap.HtlcNP2WSH}
for _, outputType := range outputTypes {
outputType := outputType
t.Run(outputType.String(), func(t *testing.T) {
t.Run("external htlc", func(t *testing.T) {
testLoopInTimeout(t, outputType, testAmt)
})
t.Run("external amount too high", func(t *testing.T) {
testLoopInTimeout(t, outputType, testAmt+1)
})
t.Run("external amount too low", func(t *testing.T) {
testLoopInTimeout(t, outputType, testAmt-1)
})
})
}
}
func testLoopInTimeout(t *testing.T, externalValue int64) {
func testLoopInTimeout(t *testing.T,
outputType swap.HtlcOutputType, externalValue int64) {
defer test.Guard(t)()
ctx := newLoopInTestContext(t)
@ -149,7 +162,7 @@ func testLoopInTimeout(t *testing.T, externalValue int64) {
req.ExternalHtlc = true
}
swap, err := newLoopInSwap(
s, err := newLoopInSwap(
context.Background(), cfg,
height, &req,
)
@ -161,7 +174,7 @@ func testLoopInTimeout(t *testing.T, externalValue int64) {
errChan := make(chan error)
go func() {
err := swap.execute(context.Background(), ctx.cfg, height)
err := s.execute(context.Background(), ctx.cfg, height)
if err != nil {
log.Error(err)
}
@ -179,10 +192,16 @@ func testLoopInTimeout(t *testing.T, externalValue int64) {
htlcTx = <-ctx.lnd.SendOutputsChannel
} else {
// Create an external htlc publish tx.
var pkScript []byte
if outputType == swap.HtlcNP2WSH {
pkScript = s.htlcNP2WSH.PkScript
} else {
pkScript = s.htlcP2WSH.PkScript
}
htlcTx = wire.MsgTx{
TxOut: []*wire.TxOut{
{
PkScript: swap.htlc.PkScript,
PkScript: pkScript,
Value: externalValue,
},
},
@ -191,6 +210,7 @@ func testLoopInTimeout(t *testing.T, externalValue int64) {
// Expect register for htlc conf.
<-ctx.lnd.RegisterConfChannel
<-ctx.lnd.RegisterConfChannel
// Confirm htlc.
ctx.lnd.ConfChannel <- &chainntnfs.TxConfirmation{
@ -207,7 +227,7 @@ func testLoopInTimeout(t *testing.T, externalValue int64) {
}
// Let htlc expire.
ctx.blockEpochChan <- swap.LoopInContract.CltvExpiry
ctx.blockEpochChan <- s.LoopInContract.CltvExpiry
// Expect a signing request for the htlc tx output value.
signReq := <-ctx.lnd.SignOutputRawChannel
@ -378,6 +398,7 @@ func testLoopInResume(t *testing.T, state loopdb.SwapState, expired bool) {
// Expect register for htlc conf.
<-ctx.lnd.RegisterConfChannel
<-ctx.lnd.RegisterConfChannel
// Confirm htlc.
ctx.lnd.ConfChannel <- &chainntnfs.TxConfirmation{

@ -52,6 +52,10 @@ type loopOutSwap struct {
loopdb.LoopOutContract
executeConfig
htlc *swap.Htlc
swapPaymentChan chan lndclient.PaymentResult
prePaymentChan chan lndclient.PaymentResult
}
@ -134,19 +138,25 @@ func newLoopOutSwap(globalCtx context.Context, cfg *swapConfig,
},
}
swapKit, err := newSwapKit(
swapKit := newSwapKit(
swapHash, swap.TypeOut, cfg, &contract.SwapContract,
swap.HtlcP2WSH,
)
swapKit.lastUpdateTime = initiationTime
// Create the htlc.
htlc, err := swapKit.getHtlc(swap.HtlcP2WSH)
if err != nil {
return nil, err
}
swapKit.lastUpdateTime = initiationTime
// Log htlc address for debugging.
swapKit.log.Infof("Htlc address: %v", htlc.Address)
swap := &loopOutSwap{
LoopOutContract: contract,
swapKit: *swapKit,
htlc: htlc,
}
// Persist the data before exiting this function, so that the caller
@ -168,17 +178,24 @@ func resumeLoopOutSwap(reqContext context.Context, cfg *swapConfig,
log.Infof("Resuming loop out swap %v", hash)
swapKit, err := newSwapKit(
swapKit := newSwapKit(
hash, swap.TypeOut, cfg, &pend.Contract.SwapContract,
swap.HtlcP2WSH,
)
// Create the htlc.
htlc, err := swapKit.getHtlc(swap.HtlcP2WSH)
if err != nil {
return nil, err
}
// Log htlc address for debugging.
swapKit.log.Infof("Htlc address: %v", htlc.Address)
// Create the swap.
swap := &loopOutSwap{
LoopOutContract: *pend.Contract,
swapKit: *swapKit,
htlc: htlc,
}
lastUpdate := pend.LastUpdate()
@ -192,6 +209,22 @@ func resumeLoopOutSwap(reqContext context.Context, cfg *swapConfig,
return swap, nil
}
// sendUpdate reports an update to the swap state.
func (s *loopOutSwap) sendUpdate(ctx context.Context) error {
info := s.swapInfo()
s.log.Infof("Loop out swap state: %v", info.State)
info.HtlcAddressP2WSH = s.htlc.Address
select {
case s.statusChan <- *info:
case <-ctx.Done():
return ctx.Err()
}
return nil
}
// execute starts/resumes the swap. It is a thin wrapper around
// executeAndFinalize to conveniently handle the error case.
func (s *loopOutSwap) execute(mainCtx context.Context,

@ -379,8 +379,23 @@ type SwapResponse struct {
//the Start() call. Currently this is the hash that locks the htlcs.
IdBytes []byte `protobuf:"bytes,3,opt,name=id_bytes,json=idBytes,proto3" json:"id_bytes,omitempty"`
//*
//The address of the on-chain htlc.
HtlcAddress string `protobuf:"bytes,2,opt,name=htlc_address,json=htlcAddress,proto3" json:"htlc_address,omitempty"`
//DEPRECATED. This field stores the address of the onchain htlc, but
//depending on the request, the semantics are different.
//- For internal loop-in htlc_address contains the address of the
//native segwit (P2WSH) htlc.
//- For external loop-in htlc_address contains the address of the
//nested segwit (NP2WSH) htlc.
//- For loop-out htlc_address always contains the native segwit (P2WSH)
//htlc address.
HtlcAddress string `protobuf:"bytes,2,opt,name=htlc_address,json=htlcAddress,proto3" json:"htlc_address,omitempty"` // Deprecated: Do not use.
//*
//The nested segwit address of the on-chain htlc.
//This field remains empty for loop-out.
HtlcAddressNp2Wsh string `protobuf:"bytes,4,opt,name=htlc_address_np2wsh,json=htlcAddressNp2wsh,proto3" json:"htlc_address_np2wsh,omitempty"`
//*
//The native segwit address of the on-chain htlc.
//Used for both loop-in and loop-out.
HtlcAddressP2Wsh string `protobuf:"bytes,5,opt,name=htlc_address_p2wsh,json=htlcAddressP2wsh,proto3" json:"htlc_address_p2wsh,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -426,6 +441,7 @@ func (m *SwapResponse) GetIdBytes() []byte {
return nil
}
// Deprecated: Do not use.
func (m *SwapResponse) GetHtlcAddress() string {
if m != nil {
return m.HtlcAddress
@ -433,6 +449,20 @@ func (m *SwapResponse) GetHtlcAddress() string {
return ""
}
func (m *SwapResponse) GetHtlcAddressNp2Wsh() string {
if m != nil {
return m.HtlcAddressNp2Wsh
}
return ""
}
func (m *SwapResponse) GetHtlcAddressP2Wsh() string {
if m != nil {
return m.HtlcAddressP2Wsh
}
return ""
}
type MonitorRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@ -492,8 +522,18 @@ type SwapStatus struct {
//Initiation time of the swap.
LastUpdateTime int64 `protobuf:"varint,6,opt,name=last_update_time,json=lastUpdateTime,proto3" json:"last_update_time,omitempty"`
//*
//Htlc address.
HtlcAddress string `protobuf:"bytes,7,opt,name=htlc_address,json=htlcAddress,proto3" json:"htlc_address,omitempty"`
//DEPRECATED: This field stores the address of the onchain htlc.
//- For internal loop-in htlc_address contains the address of the
//native segwit (P2WSH) htlc.
//- For external loop-in htlc_address contains the nested segwit (NP2WSH)
//address.
//- For loop-out htlc_address always contains the native segwit (P2WSH)
//htlc address.
HtlcAddress string `protobuf:"bytes,7,opt,name=htlc_address,json=htlcAddress,proto3" json:"htlc_address,omitempty"` // Deprecated: Do not use.
// HTLC address (native segwit), used in loop-in and loop-out swaps.
HtlcAddressP2Wsh string `protobuf:"bytes,12,opt,name=htlc_address_p2wsh,json=htlcAddressP2wsh,proto3" json:"htlc_address_p2wsh,omitempty"`
// HTLC address (nested segwit), used in loop-in swaps only.
HtlcAddressNp2Wsh string `protobuf:"bytes,13,opt,name=htlc_address_np2wsh,json=htlcAddressNp2wsh,proto3" json:"htlc_address_np2wsh,omitempty"`
/// Swap server cost
CostServer int64 `protobuf:"varint,8,opt,name=cost_server,json=costServer,proto3" json:"cost_server,omitempty"`
// On-chain transaction cost
@ -580,6 +620,7 @@ func (m *SwapStatus) GetLastUpdateTime() int64 {
return 0
}
// Deprecated: Do not use.
func (m *SwapStatus) GetHtlcAddress() string {
if m != nil {
return m.HtlcAddress
@ -587,6 +628,20 @@ func (m *SwapStatus) GetHtlcAddress() string {
return ""
}
func (m *SwapStatus) GetHtlcAddressP2Wsh() string {
if m != nil {
return m.HtlcAddressP2Wsh
}
return ""
}
func (m *SwapStatus) GetHtlcAddressNp2Wsh() string {
if m != nil {
return m.HtlcAddressNp2Wsh
}
return ""
}
func (m *SwapStatus) GetCostServer() int64 {
if m != nil {
return m.CostServer
@ -1180,98 +1235,101 @@ func init() {
func init() { proto.RegisterFile("client.proto", fileDescriptor_014de31d7ac8c57c) }
var fileDescriptor_014de31d7ac8c57c = []byte{
// 1448 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcb, 0x6e, 0xdb, 0x46,
0x14, 0x0d, 0x25, 0x59, 0x8f, 0x2b, 0x8a, 0xa2, 0xc7, 0x89, 0x2d, 0xab, 0x0d, 0xe2, 0xb0, 0x4d,
0xeb, 0x78, 0x11, 0x35, 0xce, 0xaa, 0x41, 0x51, 0xc0, 0x91, 0x95, 0x58, 0x86, 0x5f, 0xa5, 0xe4,
0x00, 0xc9, 0x86, 0x19, 0x8b, 0x63, 0x9b, 0xa8, 0xc8, 0x61, 0x38, 0xa3, 0xc4, 0x46, 0x90, 0x4d,
0x7f, 0xa1, 0xbb, 0x2e, 0xfb, 0x07, 0x5d, 0xf7, 0x2b, 0x8a, 0xfe, 0x42, 0x3f, 0xa1, 0xdb, 0x02,
0xc5, 0x3c, 0x44, 0x91, 0x96, 0x9d, 0x45, 0x76, 0xe6, 0x99, 0x33, 0x67, 0xee, 0xdc, 0xc7, 0x19,
0x19, 0xcc, 0xd1, 0x38, 0x20, 0x11, 0x7f, 0x14, 0x27, 0x94, 0x53, 0x54, 0x19, 0x53, 0x1a, 0x27,
0xf1, 0xa8, 0xfd, 0xe5, 0x19, 0xa5, 0x67, 0x63, 0xd2, 0xc1, 0x71, 0xd0, 0xc1, 0x51, 0x44, 0x39,
0xe6, 0x01, 0x8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x94, 0xa1, 0x9e, 0x94, 0xe5, 0xbf, 0x1a, 0x4f, 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff,
0xc7, 0x1e, 0x66, 0x37, 0xa1, 0x0c, 0x00, 0x00,
// 1504 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcb, 0x72, 0xdb, 0x46,
0x16, 0x35, 0xf8, 0xe6, 0x25, 0x08, 0x82, 0x2d, 0x5b, 0xa2, 0x38, 0xe3, 0xb2, 0x8c, 0x19, 0xcf,
0xc8, 0xaa, 0x29, 0x71, 0x2c, 0xaf, 0xc6, 0x35, 0x95, 0x2a, 0x99, 0xa2, 0x2d, 0xaa, 0xf4, 0x60,
0x40, 0xca, 0x55, 0xf6, 0x06, 0x69, 0x11, 0x2d, 0x11, 0x15, 0xe2, 0x61, 0x74, 0xd3, 0x92, 0xca,
0xe5, 0x4d, 0x7e, 0x21, 0xbb, 0x2c, 0xf3, 0x07, 0x59, 0x67, 0x97, 0x3f, 0x48, 0xe5, 0x03, 0xb2,
0xc9, 0x27, 0xe4, 0x03, 0x52, 0xfd, 0x20, 0x08, 0x48, 0x94, 0x17, 0xde, 0x11, 0xa7, 0x4f, 0x9f,
0xbe, 0x7d, 0xef, 0xed, 0xd3, 0x4d, 0xd0, 0xc7, 0x53, 0x8f, 0x04, 0x6c, 0x3b, 0x8a, 0x43, 0x16,
0xa2, 0xf2, 0x34, 0x0c, 0xa3, 0x38, 0x1a, 0xb7, 0xff, 0x7e, 0x11, 0x86, 0x17, 0x53, 0xd2, 0xc1,
0x91, 0xd7, 0xc1, 0x41, 0x10, 0x32, 0xcc, 0xbc, 0x30, 0xa0, 0x92, 0x66, 0xfd, 0x90, 0x07, 0xe3,
0x30, 0x0c, 0xa3, 0x93, 0x19, 0xb3, 0xc9, 0xfb, 0x19, 0xa1, 0x0c, 0x99, 0x90, 0xc7, 0x3e, 0x6b,
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0xeb, 0x68, 0x2d, 0xad, 0x9d,
0x8e, 0xfe, 0x2d, 0xd4, 0xf9, 0x0a, 0x73, 0xdf, 0xa3, 0xa9, 0xfe, 0xcd, 0x98, 0x6b, 0x7b, 0xed,
0x16, 0x9e, 0x3d, 0x13, 0xa8, 0x21, 0x96, 0xa0, 0x98, 0x75, 0xa4, 0xa1, 0x9e, 0x95, 0xc4, 0xff,
0xa5, 0xe7, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x46, 0x6c, 0x13, 0xa0, 0x66, 0x0d, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

@ -242,9 +242,28 @@ message SwapResponse {
bytes id_bytes = 3;
/**
The address of the on-chain htlc.
DEPRECATED. This field stores the address of the onchain htlc, but
depending on the request, the semantics are different.
- For internal loop-in htlc_address contains the address of the
native segwit (P2WSH) htlc.
- For external loop-in htlc_address contains the address of the
nested segwit (NP2WSH) htlc.
- For loop-out htlc_address always contains the native segwit (P2WSH)
htlc address.
*/
string htlc_address = 2;
string htlc_address = 2 [deprecated = true];
/**
The nested segwit address of the on-chain htlc.
This field remains empty for loop-out.
*/
string htlc_address_np2wsh = 4;
/**
The native segwit address of the on-chain htlc.
Used for both loop-in and loop-out.
*/
string htlc_address_p2wsh = 5;
}
message MonitorRequest {
@ -292,9 +311,21 @@ message SwapStatus {
int64 last_update_time = 6;
/**
Htlc address.
DEPRECATED: This field stores the address of the onchain htlc.
- For internal loop-in htlc_address contains the address of the
native segwit (P2WSH) htlc.
- For external loop-in htlc_address contains the nested segwit (NP2WSH)
address.
- For loop-out htlc_address always contains the native segwit (P2WSH)
htlc address.
*/
string htlc_address = 7;
string htlc_address = 7 [deprecated = true];
// HTLC address (native segwit), used in loop-in and loop-out swaps.
string htlc_address_p2wsh = 12;
// HTLC address (nested segwit), used in loop-in swaps only.
string htlc_address_np2wsh = 13;
/// Swap server cost
int64 cost_server = 8;

@ -457,7 +457,15 @@
},
"htlc_address": {
"type": "string",
"description": "*\nThe address of the on-chain htlc."
"description": "*\nDEPRECATED. This field stores the address of the onchain htlc, but\ndepending on the request, the semantics are different.\n- For internal loop-in htlc_address contains the address of the\nnative segwit (P2WSH) htlc.\n- For external loop-in htlc_address contains the address of the\nnested segwit (NP2WSH) htlc.\n- For loop-out htlc_address always contains the native segwit (P2WSH)\nhtlc address."
},
"htlc_address_np2wsh": {
"type": "string",
"description": "*\nThe nested segwit address of the on-chain htlc.\nThis field remains empty for loop-out."
},
"htlc_address_p2wsh": {
"type": "string",
"description": "*\nThe native segwit address of the on-chain htlc.\nUsed for both loop-in and loop-out."
}
}
},
@ -511,7 +519,15 @@
},
"htlc_address": {
"type": "string",
"description": "*\nHtlc address."
"description": "*\nDEPRECATED: This field stores the address of the onchain htlc.\n- For internal loop-in htlc_address contains the address of the\nnative segwit (P2WSH) htlc.\n- For external loop-in htlc_address contains the nested segwit (NP2WSH)\naddress.\n- For loop-out htlc_address always contains the native segwit (P2WSH)\nhtlc address."
},
"htlc_address_p2wsh": {
"type": "string",
"description": "HTLC address (native segwit), used in loop-in and loop-out swaps."
},
"htlc_address_np2wsh": {
"type": "string",
"description": "HTLC address (nested segwit), used in loop-in swaps only."
},
"cost_server": {
"type": "string",

@ -35,16 +35,22 @@ const (
ProtocolVersion_LEGACY ProtocolVersion = 0
/// Client may attempt to send the loop out payment in multiple parts.
ProtocolVersion_MULTI_LOOP_OUT ProtocolVersion = 1
//*
//Loop will use native segwit (P2WSH) htlcs by default, while externally
//published htlcs may use native (P2WSH) or nested (NP2WSH) segwit as well.
ProtocolVersion_NATIVE_SEGWIT_LOOP_IN ProtocolVersion = 2
)
var ProtocolVersion_name = map[int32]string{
0: "LEGACY",
1: "MULTI_LOOP_OUT",
2: "NATIVE_SEGWIT_LOOP_IN",
}
var ProtocolVersion_value = map[string]int32{
"LEGACY": 0,
"MULTI_LOOP_OUT": 1,
"LEGACY": 0,
"MULTI_LOOP_OUT": 1,
"NATIVE_SEGWIT_LOOP_IN": 2,
}
func (x ProtocolVersion) String() string {
@ -784,57 +790,58 @@ func init() {
func init() { proto.RegisterFile("server.proto", fileDescriptor_ad098daeda4239f7) }
var fileDescriptor_ad098daeda4239f7 = []byte{
// 786 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xdd, 0x52, 0xda, 0x40,
0x14, 0x6e, 0x02, 0x82, 0x1c, 0xf9, 0x73, 0xfb, 0x17, 0x50, 0x3a, 0xc8, 0x4c, 0x1d, 0xc6, 0x0b,
0x9d, 0xda, 0xbb, 0xde, 0x59, 0xad, 0x95, 0x29, 0x2d, 0x1a, 0xb1, 0x33, 0xbd, 0x4a, 0x57, 0x38,
0x95, 0x4c, 0x43, 0x36, 0x26, 0x0b, 0xca, 0x9b, 0xb4, 0x2f, 0xd1, 0xb7, 0xe9, 0x2b, 0x74, 0xa6,
0x97, 0x7d, 0x83, 0x4e, 0x36, 0x89, 0x24, 0x21, 0xa8, 0xcc, 0x78, 0x67, 0xce, 0x7e, 0x9e, 0xfd,
0xbe, 0xef, 0x9c, 0x6f, 0x81, 0xbc, 0x83, 0xf6, 0x18, 0xed, 0x6d, 0xcb, 0x66, 0x9c, 0x91, 0xac,
0xc1, 0x98, 0x65, 0x5b, 0xbd, 0xea, 0xfa, 0x05, 0x63, 0x17, 0x06, 0xee, 0x50, 0x4b, 0xdf, 0xa1,
0xa6, 0xc9, 0x38, 0xe5, 0x3a, 0x33, 0x1d, 0x0f, 0xd6, 0xf8, 0x2b, 0xc1, 0x93, 0x53, 0xf1, 0x7f,
0x6d, 0xc6, 0xac, 0xce, 0x88, 0xab, 0x78, 0x39, 0x42, 0x87, 0x93, 0x0d, 0xc8, 0xdb, 0xd8, 0x43,
0x7d, 0x8c, 0xb6, 0xf6, 0x1d, 0x27, 0x8a, 0x54, 0x97, 0x9a, 0x79, 0x75, 0x25, 0xa8, 0x7d, 0xc0,
0x09, 0x59, 0x83, 0x9c, 0x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0x30, 0x1c, 0x86, 0x79, 0x0c,
0xbd, 0x06, 0x6d, 0x58, 0x09, 0xcf, 0x64, 0x23, 0x01, 0x1b, 0x5d, 0x88, 0x6a, 0x75, 0x3e, 0x84,
0xb4, 0xa1, 0xe0, 0xeb, 0x6d, 0x89, 0x09, 0x92, 0xf5, 0x44, 0x70, 0xd0, 0xaa, 0x36, 0xe7, 0xd4,
0x17, 0xdb, 0x0d, 0xb8, 0x79, 0x54, 0x93, 0xb9, 0x45, 0xa4, 0x36, 0x6e, 0x83, 0x78, 0x5d, 0xcf,
0x33, 0x62, 0x39, 0x5f, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xd4, 0x54, 0xd0, 0xf3, 0xcd, 0x09,
0x00, 0x00,
// 810 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xdd, 0x52, 0xe2, 0x48,
0x14, 0xde, 0x04, 0x04, 0x39, 0xf2, 0x67, 0xef, 0xba, 0x1b, 0x50, 0xb6, 0x90, 0xaa, 0xb5, 0x28,
0x2f, 0xb4, 0xca, 0xbd, 0xdb, 0x3b, 0xd6, 0x5f, 0x6a, 0x59, 0xd1, 0x88, 0x6e, 0xed, 0x55, 0xa6,
0x85, 0x1e, 0x49, 0x4d, 0x48, 0xc7, 0xa4, 0x41, 0x79, 0x93, 0x99, 0x97, 0x98, 0xb7, 0x99, 0x57,
0x98, 0xaa, 0xb9, 0x9c, 0x37, 0x98, 0xea, 0xee, 0x44, 0x92, 0x10, 0x54, 0xaa, 0xbc, 0x33, 0xe7,
0x7c, 0x76, 0x7f, 0xdf, 0x77, 0xce, 0xd7, 0x40, 0xde, 0x23, 0xee, 0x84, 0xb8, 0x7b, 0x8e, 0x4b,
0x19, 0x45, 0x59, 0x8b, 0x52, 0xc7, 0x75, 0xfa, 0xd5, 0xad, 0x3b, 0x4a, 0xef, 0x2c, 0xb2, 0x8f,
0x1d,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 0x82, 0x2a, 0xb0,
0x71, 0xde, 0xea, 0xb5, 0x6f, 0x8e, 0x8d, 0xab, 0xe3, 0xd3, 0xff, 0xda, 0x3d, 0xd9, 0x6b, 0x9f,
0x97, 0xd5, 0x83, 0xef, 0x29, 0x00, 0x7e, 0xb8, 0xe4, 0x8d, 0xba, 0x90, 0x8f, 0xbc, 0x04, 0x8d,
0x27, 0xf1, 0x0b, 0x1f, 0xa2, 0xea, 0xe6, 0x33, 0x18, 0xd4, 0x85, 0xe2, 0x39, 0x79, 0xf0, 0x4b,
0xfc, 0x22, 0x54, 0x4b, 0x86, 0x07, 0xa7, 0xfd, 0xbe, 0xa8, 0xed, 0xaf, 0xdf, 0x8c, 0xa1, 0xfc,
0xa1, 0x58, 0xc0, 0x30, 0x9c, 0x93, 0x45, 0x0c, 0xe5, 0x01, 0x1d, 0x58, 0x0b, 0x8f, 0x6b, 0x3b,
0x01, 0x1b, 0xdd, 0x95, 0x6a, 0x75, 0x31, 0x04, 0x75, 0xa0, 0xe0, 0xeb, 0x6d, 0x8b, 0xe1, 0xa2,
0xad, 0x44, 0x70, 0x70, 0x54, 0x6d, 0x41, 0xd7, 0x17, 0xdb, 0x0b, 0xb8, 0x49, 0xaa, 0xc9, 0xdc,
0x22, 0x52, 0x1b, 0xcf, 0x41, 0xe4, 0xa9, 0xb7, 0x19, 0xb1, 0xb7, 0x7f, 0xfe, 0x08, 0x00, 0x00,
0xff, 0xff, 0xd3, 0x5d, 0x9c, 0x31, 0xe8, 0x09, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

@ -31,6 +31,12 @@ enum ProtocolVersion {
/// Client may attempt to send the loop out payment in multiple parts.
MULTI_LOOP_OUT = 1;
/**
Loop will use native segwit (P2WSH) htlcs by default, while externally
published htlcs may use native (P2WSH) or nested (NP2WSH) segwit as well.
*/
NATIVE_SEGWIT_LOOP_IN = 2;
}
message ServerLoopOutRequest {

@ -11,7 +11,6 @@ import (
)
type swapKit struct {
htlc *swap.Htlc
hash lntypes.Hash
height int32
@ -19,51 +18,49 @@ type swapKit struct {
log *swap.PrefixLog
lastUpdateTime time.Time
cost loopdb.SwapCost
state loopdb.SwapState
executeConfig
swapConfig
cost loopdb.SwapCost
state loopdb.SwapState
contract *loopdb.SwapContract
swapType swap.Type
swapConfig
}
func newSwapKit(hash lntypes.Hash, swapType swap.Type, cfg *swapConfig,
contract *loopdb.SwapContract, outputType swap.HtlcOutputType) (
*swapKit, error) {
// Compose expected on-chain swap script
htlc, err := swap.NewHtlc(
contract.CltvExpiry, contract.SenderKey,
contract.ReceiverKey, hash, outputType,
cfg.lnd.ChainParams,
)
if err != nil {
return nil, err
}
contract *loopdb.SwapContract) *swapKit {
log := &swap.PrefixLog{
Hash: hash,
Logger: log,
}
// Log htlc address for debugging.
log.Infof("Htlc address: %v", htlc.Address)
return &swapKit{
swapConfig: *cfg,
hash: hash,
log: log,
htlc: htlc,
state: loopdb.StateInitiated,
contract: contract,
swapType: swapType,
}, nil
}
}
// getHtlc composes and returns the on-chain swap script.
func (s *swapKit) getHtlc(outputType swap.HtlcOutputType) (*swap.Htlc, error) {
return swap.NewHtlc(
s.contract.CltvExpiry, s.contract.SenderKey,
s.contract.ReceiverKey, s.hash, outputType,
s.swapConfig.lnd.ChainParams,
)
}
// sendUpdate reports an update to the swap state.
func (s *swapKit) sendUpdate(ctx context.Context) error {
info := &SwapInfo{
// swapInfo constructs and returns a filled SwapInfo from
// the swapKit.
func (s *swapKit) swapInfo() *SwapInfo {
return &SwapInfo{
SwapContract: *s.contract,
SwapHash: s.hash,
SwapType: s.swapType,
@ -72,18 +69,7 @@ func (s *swapKit) sendUpdate(ctx context.Context) error {
State: s.state,
Cost: s.cost,
},
HtlcAddress: s.htlc.Address,
}
s.log.Infof("state %v", info.State)
select {
case s.statusChan <- *info:
case <-ctx.Done():
return ctx.Err()
}
return nil
}
type genericSwap interface {

@ -50,6 +50,20 @@ var (
)
)
// String returns the string value of HtlcOutputType.
func (h HtlcOutputType) String() string {
switch h {
case HtlcP2WSH:
return "P2WSH"
case HtlcNP2WSH:
return "NP2WSH"
default:
return "unknown"
}
}
// NewHtlc returns a new instance.
func NewHtlc(cltvExpiry int32, senderKey, receiverKey [33]byte,
hash lntypes.Hash, outputType HtlcOutputType,

@ -22,7 +22,7 @@ import (
// protocolVersion defines the version of the protocol that is currently
// supported by the loop client.
const protocolVersion = looprpc.ProtocolVersion_MULTI_LOOP_OUT
const protocolVersion = looprpc.ProtocolVersion_NATIVE_SEGWIT_LOOP_IN
type swapServerClient interface {
GetLoopOutTerms(ctx context.Context) (

Loading…
Cancel
Save