mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-19 13:17:50 +02:00
swap: fix htlc address generation
This commit fixes the generation of the htlc address. This bug didn't affect the swap execution, because the htlc address is only used for display to the user/caller.
This commit is contained in:
parent
ca3cfc1431
commit
753429547d
1 changed files with 2 additions and 4 deletions
|
|
@ -67,15 +67,13 @@ func NewHtlc(cltvExpiry int32, senderKey, receiverKey [33]byte,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
p2wshPkScriptHash := sha256.Sum256(p2wshPkScript)
|
||||
|
||||
var pkScript, sigScript []byte
|
||||
var address btcutil.Address
|
||||
|
||||
switch outputType {
|
||||
case HtlcNP2WSH:
|
||||
// Generate p2sh script for p2wsh (nested).
|
||||
|
||||
p2wshPkScriptHash := sha256.Sum256(p2wshPkScript)
|
||||
hash160 := input.Ripemd160H(p2wshPkScriptHash[:])
|
||||
|
||||
builder := txscript.NewScriptBuilder()
|
||||
|
|
@ -111,7 +109,7 @@ func NewHtlc(cltvExpiry int32, senderKey, receiverKey [33]byte,
|
|||
pkScript = p2wshPkScript
|
||||
|
||||
address, err = btcutil.NewAddressWitnessScriptHash(
|
||||
p2wshPkScriptHash[:],
|
||||
p2wshPkScript[2:],
|
||||
chainParams,
|
||||
)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue