-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set label #283
Set label #283
Conversation
go.mod
Outdated
@@ -151,3 +151,5 @@ 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-20240213204501-f17161a057dc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[todo]remove this once glightning is updated
6ce0b06
to
d9a4d08
Compare
Let's do this ...
|
OK, I will create a PR to document it.
This PR change calls the set label of bitcoind even if cln is used.
I agree.
It would be possible to offer the option to connect to the daemon used by lnd and another daemon. |
CLN uses bitcoind only to read blocks/transactions. CLN has its own onchain wallet which unfortunately lacks labels entirely. Requests like #96 have asked peerswap to offer the ability to use a different BTC onchain wallet for those who want to keep it separate from their CLN funds. Even if we add this as an option it would be confusing to have setlabel when it can't work with the default CLN onchain wallet. That said maybe we should include ElementsProject/glightning#12 limited to elementsd for now since it would work for our default L-BTC wallet. Thoughts @nepet ? Related question: Does our CLN peerswap currently communicate entirely via CLN RPC or does it also connect to bitcoind and elementsd directly? |
For now let's go ahead with this part. Please note the CLN bitcoind setlabel is currently not supported due to CLN onchain wallet's lack of labels. |
How does this currently work? |
My understanding is as follows clnIn the case of cln, peerswap starts as a cln plugin, but peerswap also has its own jsonrpc connection to bitcoind for onchain communication.(config) The default is to connect to the same bitcoind as the bitcoind that cln connects to, but it is also possible to set up a different bitcoind. If liquid is enabled, peerswapd calls the function via elementd jsonrpc. graph LR
subgraph clnplugin
peerswap --> cln
end
cln --> bitcoind,etc
peerswap ---> elementd
peerswap ---> bitcoind,etc
My understanding is that #96 is sorted out by #153 how to set up a jsonrpc connection with bitcoind using config file. lndIn lnd, onchain exchange is done using Wallet in lnd's grpc, and connection with bitcoind is not provided. graph LR
peerswapd --> lnd
peerswapd --> elementd
subgraph lndnode
lnd --> bitcoind,btcd,neutrino
end
Therefore, for lnd, there is currently no way to set up another onchain wallet, so this is something to consider. graph LR
classDef color font-style:italic,stroke:yellow
peerswapd --> lnd
peerswapd --> elementd
subgraph lndnode
lnd --> bitcoind,btcd,neutrino
end
peerswapd --> alternativebitcoindamon:::color
|
When swapout is performed in cln with this PR, the label can be confirmed in bitcoind connected to peerswap as follows. ./bin/clncli peerswap-listswaps
{
"swaps": [
{
"id": "085b1368810005a30610adf6ba00ce01258d2d2605798ec20663feb16023a5b9",
"created_at": 1708562187,
"asset": "btc",
"type": "swap-out",
"role": "sender",
"state": "State_ClaimedPreimage",
"initiator_node_id": "022d6b27d4577dad8ee17466be3e9e4af6e2ac80a600453c28f8be2ae66af8b548",
"peer_node_id": "02496a469ebf47bce20b7c0ac661f306b84cde3bbf6860d868e117d8ff3f18062c",
"amount": 1000000,
"channel_id": "231x1x0",
"opening_tx_id": "4ae28ab0e547fcf23579059a1689a9f5c91dc97c2c9e804ba0d476171085be7f",
"claim_tx_id": "d3ceb004d9464e266a181ea4639e4e836820d5ff8fdfe19b7d846c53d46362da",
"lnd_chan_id": 253987186081792
}
]
} ./bin/bitcoin-cli listlabels
[
"",
"peerswap -- ClaimByInvoice(swap id=085b13)"
] ./bin/bitcoin-cli getaddressesbylabel "peerswap -- ClaimByInvoice(swap id=085b13)"
{
"bcrt1q7y2zlrysa3qjsqz0x4m6jh6w8tun996y3cfzw3": {
"purpose": "send"
}
} |
The default CLN onchain wallet does not use bitcoind's wallet. CLN works with bitcoind disablewallet=1.
I'm confused how this is possible. #153 was not intended to do anything like #96. If it did so it was an accident. Supporting #96 would require lots of extra work because it would be confusing and difficult to support querying two different bitcoinds. If CLN peerswap currently can do a swap with a secondary bitcoind wallet that is NOT INTENDED. CLN would not see those UTXO's because it is not within its own onchain wallet. The user would need to manually spend it to make it available to CLN again.
Nobody requested this feature for LND peerswap. |
I was confusing the bitcoin daemon with the bitcoin wallet.
Currently it is not possible to swap with multiple wallets. Since it is not possible to label the cln wallet, I will try to set the label only on the cln elementd only, as discussed separately. |
Ensure that all cln/liquid transactions related to peerswaps are identifiable by the label. This makes it easier to audit the transactions. if it fails, it is logged and subsequent processing is continued.
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.
d9a4d08
to
5128839
Compare
Ensure that all liquid transactions related to peerswaps are identifiable by the label.
This makes it easier to audit the transactions.
if it fails, it is logged and subsequent processing is continued.
This depends on the following PR.
#282