mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loopd: disable mainnet loop in
This commit is contained in:
parent
3e960b8b54
commit
8b2da64b0a
2 changed files with 33 additions and 15 deletions
|
|
@ -24,19 +24,6 @@ func terms(ctx *cli.Context) error {
|
|||
}
|
||||
defer cleanup()
|
||||
|
||||
req := &looprpc.TermsRequest{}
|
||||
loopOutTerms, err := client.LoopOutTerms(context.Background(), req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
loopInTerms, err := client.GetLoopInTerms(
|
||||
context.Background(), &looprpc.TermsRequest{},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printTerms := func(terms *looprpc.TermsResponse) {
|
||||
fmt.Printf("Amount: %d - %d\n",
|
||||
btcutil.Amount(terms.MinSwapAmount),
|
||||
|
|
@ -53,13 +40,26 @@ func terms(ctx *cli.Context) error {
|
|||
|
||||
fmt.Println("Loop Out")
|
||||
fmt.Println("--------")
|
||||
printTerms(loopOutTerms)
|
||||
req := &looprpc.TermsRequest{}
|
||||
loopOutTerms, err := client.LoopOutTerms(context.Background(), req)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
} else {
|
||||
printTerms(loopOutTerms)
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
|
||||
fmt.Println("Loop In")
|
||||
fmt.Println("------")
|
||||
printTerms(loopInTerms)
|
||||
loopInTerms, err := client.GetLoopInTerms(
|
||||
context.Background(), &looprpc.TermsRequest{},
|
||||
)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
} else {
|
||||
printTerms(loopInTerms)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import (
|
|||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
|
||||
"github.com/lightningnetwork/lnd/queue"
|
||||
|
||||
"github.com/lightninglabs/loop"
|
||||
|
|
@ -19,6 +21,10 @@ import (
|
|||
|
||||
const completedSwapsCount = 5
|
||||
|
||||
var (
|
||||
errNoMainnet = errors.New("function not available on mainnet")
|
||||
)
|
||||
|
||||
// swapClientServer implements the grpc service exposed by loopd.
|
||||
type swapClientServer struct {
|
||||
impl *loop.Client
|
||||
|
|
@ -270,6 +276,10 @@ func (s *swapClientServer) GetLoopInTerms(ctx context.Context, req *looprpc.Term
|
|||
|
||||
logger.Infof("Loop in terms request received")
|
||||
|
||||
if s.lnd.ChainParams.Name == chaincfg.MainNetParams.Name {
|
||||
return nil, errNoMainnet
|
||||
}
|
||||
|
||||
terms, err := s.impl.LoopInTerms(ctx)
|
||||
if err != nil {
|
||||
logger.Errorf("Terms request: %v", err)
|
||||
|
|
@ -291,6 +301,10 @@ func (s *swapClientServer) GetLoopInQuote(ctx context.Context,
|
|||
|
||||
logger.Infof("Loop in quote request received")
|
||||
|
||||
if s.lnd.ChainParams.Name == chaincfg.MainNetParams.Name {
|
||||
return nil, errNoMainnet
|
||||
}
|
||||
|
||||
quote, err := s.impl.LoopInQuote(ctx, &loop.LoopInQuoteRequest{
|
||||
Amount: btcutil.Amount(req.Amt),
|
||||
HtlcConfTarget: defaultConfTarget,
|
||||
|
|
@ -310,6 +324,10 @@ func (s *swapClientServer) LoopIn(ctx context.Context,
|
|||
|
||||
logger.Infof("Loop in request received")
|
||||
|
||||
if s.lnd.ChainParams.Name == chaincfg.MainNetParams.Name {
|
||||
return nil, errNoMainnet
|
||||
}
|
||||
|
||||
req := &loop.LoopInRequest{
|
||||
Amount: btcutil.Amount(in.Amt),
|
||||
MaxMinerFee: btcutil.Amount(in.MaxMinerFee),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue