Open Harshit933 opened 1 month ago
My conf :
network=regtest
backend=core
core-user=user
core-pass=pass
core-url=http://127.0.0.1:38332
port=39736
log-level=trace
alias=doom
I investigated about this issue and came up with the following :
Suppose we create a fresh wallet using lampod-cli --network testnet
. It creates a new core wallet inside .bitcoin/testnet3/lampo-wallet/
and stores all the wallet.dat
files there and manager
file which is created by LampoChannelManager
stores the LampoKeys
inside .lampo/testnet/
.
But if the .lampo
directory gets deleted which contains the manager
file. Our wallet keys are then gone. Then, when we try to spin up a new wallet with the same lampod-cli --network testnet
command the new wallet does spin up but just points to the old one because :
https://github.com/vincenzopalazzo/lampo.rs/blob/e3e0b910bfce740f2530a80ed94fe59b0e35142d/lampo-core-wallet/src/lib.rs#L214
The configure_wallet
fails with the condition :
https://github.com/vincenzopalazzo/lampo.rs/blob/e3e0b910bfce740f2530a80ed94fe59b0e35142d/lampo-core-wallet/src/lib.rs#L107
As listwallets
rpc does contains the old wallet. Thus, when we use lampo-cli --network testnet funds
it points to the transaction which was present inside the old wallet (as it never gets deleted, only keys are deleted from manager
).
Correct, this is expected! if you delete your lightning dir you are fuck up anyway and you lose your funds.
When you talk about real funds this is a really bead deal and you should not, and I repeat SHOULD NOT delete your folder.
The case that you described is a feature, because you did not restore your wallet.
So maybe when let wallet_name = Self::configure_bitcoin_wallet(&rpc, conf.clone(), wallet)?;
return a wallet, but you are not passing a --restore-wallet
, lampo should return an error and tell the user, that there is already a wallet and you need to restore it in order to generate the correct keys and secret in lampo.
So maybe when
let wallet_name = Self::configure_bitcoin_wallet(&rpc, conf.clone(), wallet)?;
return a wallet, but you are not passing a--restore-wallet
, lampo should return an error and tell the user, that there is already a wallet and you need to restore it in order to generate the correct keys and secret in lampo.
This seems the correct thing to do!
@Harshit933 When you have time can you close this issue and open another one that describe the problem?
I freshly created a new wallet inside
lampo
. Butlampo-cli --network regtest funds
give me some different transactions.This should not happen.