如何将 c-lightning 与主网区块链重新同步?
How to re-sync c-lightning with mainnet blockchain?
我正在尝试 https://github.com/ElementsProject/lightning 的闪电实现,在执行以下步骤后,客户端无法列出我从内部钱包存入生成地址的资金
- 我安装了 bitcoind-0.16 并完全同步了主网区块链
- 我安装了c-lightning并与本地全节点同步
- 我用
./lightning-cli newaddr
生成了一个新地址
- 我从我的 Electrum 钱包(而不是本地节点钱包)为这个地址提供资金,并看到了
./lightning-cli listfunds
的传入交易
- 然后我不小心把文件删了
.lightning/lightningd.sqlite3
- 重启后 lightningd 重新创建了文件,但现在
./lightning-cli listfunds
显示空结果,但资金必须存在,因为资金交易在区块链中可见。
我调查了./lightning-cli dev-listaddrs
,它显示了内部钱包的所有地址,还有我的资金地址。所以我想我需要将 lightningd 与比特币区块链重新同步,但是 ./lightning-cli dev-rescan-outputs
没有成功。
我该怎么做才能再次看到并使用这些资金?或者,如何获取内部(闪电)钱包的 seed/private 密钥?
这里的 c-lightning 会员给出了完美的答案:https://github.com/ElementsProject/lightning/issues/1170
如果 link 死亡:
Well, the short answer is do not delete the db, that will end up losing funds, just like deleting the wallet.dat would in bitcoind.
The long answer is, use newaddr to regenerate all addresses you had (it's ok to call it a few times too many). Then stop lightningd, open lightningd.sqlite3 and tell it to scan from an earlier block:
sqlite3 $HOME/.lightning/lightningd.sqlite3 "UPDATE vars SET val= 500000 WHERE name='last_processed_block';"
Then restart lightningd and it should start scanning the blocks from height 500'000 (which will take quite some time).
Notice that this only works as long as you don't have channels open, since in that case you're no longer the sole owner of the funds. So never delete the DB!
我正在尝试 https://github.com/ElementsProject/lightning 的闪电实现,在执行以下步骤后,客户端无法列出我从内部钱包存入生成地址的资金
- 我安装了 bitcoind-0.16 并完全同步了主网区块链
- 我安装了c-lightning并与本地全节点同步
- 我用
./lightning-cli newaddr
生成了一个新地址
- 我从我的 Electrum 钱包(而不是本地节点钱包)为这个地址提供资金,并看到了
./lightning-cli listfunds
的传入交易
- 然后我不小心把文件删了
.lightning/lightningd.sqlite3
- 重启后 lightningd 重新创建了文件,但现在
./lightning-cli listfunds
显示空结果,但资金必须存在,因为资金交易在区块链中可见。
我调查了./lightning-cli dev-listaddrs
,它显示了内部钱包的所有地址,还有我的资金地址。所以我想我需要将 lightningd 与比特币区块链重新同步,但是 ./lightning-cli dev-rescan-outputs
没有成功。
我该怎么做才能再次看到并使用这些资金?或者,如何获取内部(闪电)钱包的 seed/private 密钥?
这里的 c-lightning 会员给出了完美的答案:https://github.com/ElementsProject/lightning/issues/1170
如果 link 死亡:
Well, the short answer is do not delete the db, that will end up losing funds, just like deleting the wallet.dat would in bitcoind.
The long answer is, use newaddr to regenerate all addresses you had (it's ok to call it a few times too many). Then stop lightningd, open lightningd.sqlite3 and tell it to scan from an earlier block:
sqlite3 $HOME/.lightning/lightningd.sqlite3 "UPDATE vars SET val= 500000 WHERE name='last_processed_block';"
Then restart lightningd and it should start scanning the blocks from height 500'000 (which will take quite some time).
Notice that this only works as long as you don't have channels open, since in that case you're no longer the sole owner of the funds. So never delete the DB!