Skip to content

Commit

Permalink
glightning: update dependencies for glightning
Browse files Browse the repository at this point in the history
Add RpcPasswordFile field to configuration for Bitcoin RPC connection.
If no user name or passphrase is set, obtained from a cookie.
If bitcoind or elementsd had restarted then their
respective cookies would have changed.

Since it is not possible to label the cln wallet,
 set the label only on the cln elementd only.
  • Loading branch information
YusukeShimizu committed Feb 24, 2024
1 parent 92c3ee1 commit 5128839
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
5 changes: 4 additions & 1 deletion clightning/clightning_wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ func (cl *ClightningClient) CreateCoopSpendingTransaction(swapParams *swap.Openi
}

func (cl *ClightningClient) SetLabel(txID, address, label string) error {
return cl.gbitcoin.SetLabel(address, label)
// todo implement
// This function assigns an identifiable label to the target transaction based on the txid.
// Currently no such functionality is available, so it has not been implemented.
return nil
}

func (cl *ClightningClient) NewAddress() (string, error) {
Expand Down
4 changes: 3 additions & 1 deletion cmd/peerswap-plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func run(ctx context.Context, lightningPlugin *clightning.ClightningClient) erro
config.Liquid.RpcUser,
config.Liquid.RpcPassword,
config.Liquid.RpcHost,
config.Liquid.RpcPasswordFile,
config.Liquid.RpcPort,
)
if err != nil {
Expand Down Expand Up @@ -436,8 +437,9 @@ func getBitcoinClient(li *glightning.Lightning, pluginConfig *clightning.Config)
rpcPassword := pluginConfig.Bitcoin.RpcPassword
rpcHost := pluginConfig.Bitcoin.RpcHost
rpcPort := pluginConfig.Bitcoin.RpcPort
ppcCookie := pluginConfig.Bitcoin.RpcPasswordFile

bitcoin := gbitcoin.NewBitcoin(rpcUser, rpcPassword)
bitcoin := gbitcoin.NewBitcoin(rpcUser, rpcPassword, ppcCookie)
bitcoin.SetTimeout(10)
err := bitcoin.StartUp(rpcHost, "", uint(rpcPort))
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion cmd/peerswaplnd/peerswapd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func run() error {
liquidConfig.RpcUser,
liquidConfig.RpcPassword,
liquidConfig.RpcHost,
liquidConfig.RpcPasswordFile,
liquidConfig.RpcPort,
)
if err != nil {
Expand Down Expand Up @@ -441,7 +442,7 @@ func getBitcoinChain(ctx context.Context, li lnrpc.LightningClient) (*chaincfg.P
}

func getBitcoinClient(cfg *peerswaplnd.OnchainConfig) (*gbitcoin.Bitcoin, error) {
bitcoin := gbitcoin.NewBitcoin(cfg.RpcUser, cfg.RpcPassword)
bitcoin := gbitcoin.NewBitcoin(cfg.RpcUser, cfg.RpcPassword, cfg.RpcCookieFilePath)
err := bitcoin.StartUp(cfg.RpcHost, "", cfg.RpcPort)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions elements/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
type ElementsClientBuilder struct {
}

func NewClient(rpcUser, rpcPassword, rpcHost string, rpcPort uint) (*gelements.Elements, error) {
c := gelements.NewElements(rpcUser, rpcPassword)
func NewClient(rpcUser, rpcPassword, rpcHost, RpcPasswordFile string, rpcPort uint) (*gelements.Elements, error) {
c := gelements.NewElements(rpcUser, rpcPassword, RpcPasswordFile)

var backoff int64 = 1
for {
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/btcsuite/btcd/btcutil v1.1.2
github.com/btcsuite/btcd/btcutil/psbt v1.1.5
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
github.com/elementsproject/glightning v0.0.0-20231126051537-e32b4dae6cbb
github.com/elementsproject/glightning v0.0.0-20240224063423-55240d61b52a
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3
github.com/jessevdk/go-flags v1.5.0
Expand Down Expand Up @@ -151,5 +151,3 @@ require (

// This fork contains some options we need to reconnect to lnd.
replace github.com/grpc-ecosystem/go-grpc-middleware => github.com/nepet/go-grpc-middleware v1.3.1-0.20220824133300-340e95267339

replace github.com/elementsproject/glightning => github.com/yusukeshimizu/glightning v0.0.0-20240214001938-06d9e0562297
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dvyukov/go-fuzz v0.0.0-20220726122315-1d375ef9f9f6 h1:sE4tvxWw01v7K3MAHwKF2UF3xQbgy23PRURntuV1CkU=
github.com/dvyukov/go-fuzz v0.0.0-20220726122315-1d375ef9f9f6/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=
github.com/elementsproject/glightning v0.0.0-20240224063423-55240d61b52a h1:xnVQmVqGmSs3m8zPQF4iYEYiUAmJx8MlT9vJ3lAaOjc=
github.com/elementsproject/glightning v0.0.0-20240224063423-55240d61b52a/go.mod h1:YAdIeSyx8VEhDCtEaGOJLmWNpPaQ3x4vYSAj9Vrppdo=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
Expand Down

0 comments on commit 5128839

Please sign in to comment.