mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
use np2wsh for loop in htlc
This commit is contained in:
parent
e765baa1f9
commit
30c7d71c57
10 changed files with 219 additions and 113 deletions
16
swap.go
16
swap.go
|
|
@ -29,29 +29,26 @@ type swapKit struct {
|
|||
}
|
||||
|
||||
func newSwapKit(hash lntypes.Hash, swapType Type, cfg *swapConfig,
|
||||
contract *loopdb.SwapContract) (*swapKit, error) {
|
||||
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,
|
||||
contract.ReceiverKey, hash, outputType,
|
||||
cfg.lnd.ChainParams,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Log htlc address for debugging.
|
||||
htlcAddress, err := htlc.Address(cfg.lnd.ChainParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log := &SwapLog{
|
||||
Hash: hash,
|
||||
Logger: logger,
|
||||
}
|
||||
|
||||
log.Infof("Htlc address: %v", htlcAddress)
|
||||
// Log htlc address for debugging.
|
||||
log.Infof("Htlc address: %v", htlc.Address)
|
||||
|
||||
return &swapKit{
|
||||
swapConfig: *cfg,
|
||||
|
|
@ -72,6 +69,7 @@ func (s *swapKit) sendUpdate(ctx context.Context) error {
|
|||
SwapType: s.swapType,
|
||||
LastUpdate: s.lastUpdateTime,
|
||||
State: s.state,
|
||||
HtlcAddress: s.htlc.Address,
|
||||
}
|
||||
|
||||
s.log.Infof("state %v", info.State)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue