mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
lndclient: move to github.com/lightninglabs/lndclient
This commit is contained in:
parent
d4046a6053
commit
0c9fcd790e
42 changed files with 44 additions and 3702 deletions
27
swap/net.go
27
swap/net.go
|
|
@ -1,27 +0,0 @@
|
|||
package swap
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
)
|
||||
|
||||
// ChainParamsFromNetwork returns chain parameters based on a network name.
|
||||
func ChainParamsFromNetwork(network string) (*chaincfg.Params, error) {
|
||||
switch network {
|
||||
case "mainnet":
|
||||
return &chaincfg.MainNetParams, nil
|
||||
|
||||
case "testnet":
|
||||
return &chaincfg.TestNet3Params, nil
|
||||
|
||||
case "regtest":
|
||||
return &chaincfg.RegressionNetParams, nil
|
||||
|
||||
case "simnet":
|
||||
return &chaincfg.SimNetParams, nil
|
||||
|
||||
default:
|
||||
return nil, errors.New("unknown network")
|
||||
}
|
||||
}
|
||||
24
swap/tx.go
24
swap/tx.go
|
|
@ -9,30 +9,6 @@ import (
|
|||
"github.com/btcsuite/btcutil"
|
||||
)
|
||||
|
||||
// EncodeTx encodes a tx to raw bytes.
|
||||
func EncodeTx(tx *wire.MsgTx) ([]byte, error) {
|
||||
var buffer bytes.Buffer
|
||||
err := tx.BtcEncode(&buffer, 0, wire.WitnessEncoding)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rawTx := buffer.Bytes()
|
||||
|
||||
return rawTx, nil
|
||||
}
|
||||
|
||||
// DecodeTx decodes raw tx bytes.
|
||||
func DecodeTx(rawTx []byte) (*wire.MsgTx, error) {
|
||||
tx := wire.MsgTx{}
|
||||
r := bytes.NewReader(rawTx)
|
||||
err := tx.BtcDecode(r, 0, wire.WitnessEncoding)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &tx, nil
|
||||
}
|
||||
|
||||
// GetScriptOutput locates the given script in the outputs of a transaction and
|
||||
// returns its outpoint and value.
|
||||
func GetScriptOutput(htlcTx *wire.MsgTx, scriptHash []byte) (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue