You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sync with pruned bitcoind: getblock ... false exited with status 1 #1502
root@vultr:~/lightning# lightningd/lightningd --bitcoin-datadir /root/.bitcoin/ --log-level debug --mainnet
2018-05-14T09:13:56.261Z lightningd(12665): testing /root/lightning/lightningd/lightning_channeld
2018-05-14T09:13:56.266Z lightningd(12665): testing /root/lightning/lightningd/lightning_closingd
2018-05-14T09:13:56.271Z lightningd(12665): testing /root/lightning/lightningd/lightning_gossipd
2018-05-14T09:13:56.274Z lightningd(12665): testing /root/lightning/lightningd/lightning_hsmd
2018-05-14T09:13:56.278Z lightningd(12665): testing /root/lightning/lightningd/lightning_onchaind
2018-05-14T09:13:56.282Z lightningd(12665): testing /root/lightning/lightningd/lightning_openingd
2018-05-14T09:13:56.318Z lightningd(12665): Client: Received message 11 from client
2018-05-14T09:13:56.319Z lightningd(12665): Client: Received message 9 from client
2018-05-14T09:13:56.319Z lightning_gossipd(12673): pid 12673, msgfd 12
2018-05-14T09:13:56.320Z lightningd(12665): Loaded 0 channels from DB
2018-05-14T09:13:56.369Z lightning_gossipd(12673): gossip_store: Read 0/0/0/0 cannounce/cupdate/nannounce/cdelete from store in 1 bytes
2018-05-14T09:14:00.726Z lightningd(12665): bitcoin-cli -datadir=/root/.bitcoin/ getblock 00000000000000000033e79243292ed910a36ff17d31e5e7f9ea6bd4df423d8d false exited with status 1
Using ubuntu 16.04, bitcoin core 0.16 and lightningd v0.5.2-2016-11-21-2716-g1125682
Lighningd is catching up until block #307718 than I got the error above.
I'm running bitcoind in pruned mode, was reading that the elements implementation could handle this.
@egodigitus have not used pruning lately but it's some important part.
and #1398 is a step forward, but we still state in README.md that pruned bitcoind is not supported.
also @Sjors wanted to test, no idea how far that is?
I've been running c-lightning with a pruned node for a while now. It seems to work fine, but I also make sure c-lightning doesn't get shut down for prolonged periods of time (beyond the prune horizon).
Well, there is the issue: bitcoind pruned it before lightningd could process it. While lightningd "can" be made to work with pruned bitcoind, it requires extreme care not to let bitcoind go forward sp fast that lightningd drops below the pruning horizon. This is one reason why we still officially do not support pruned bitcoind: there is a significant amount of extra work you need to do (e.g. have a monitor program that checks that lightningd is alive and if it dies, kill bitcoind).
Unfortunately it seems your only remaining option is to scrap your bitcoin directory and re-download from scratch, let bitcoindrun in non-pruning mode to catch up, let lightningd catch up, and then prune. Which still requires that you have extra disk space.
Alternately if you are willing to lose all the money you have in the lightningd you could just delete your .lightning dir, then run a new lightningd (which again you need to keep up-to-date with the pruned bitcoind).
We do not officially support pruned bitcoind yet, and while it is "possible" to get it running with pruned bitcoind, it is highly not recommended due to issues like this.
activate pruning
Mmmh this eliminates the advantages of a pruned node somehow, like not needing a big harddrive...
In step (1) you can sync with pruning enabled, so need need for a big disk (although it's a bit slow).
You can even start lightningd right away, as long as it stays on top of the initial blockchain download. However it's easier to start lightningd after the sync is done, and I get the impression (not measured) that lightningd slows down IBD.
To recover from a situation where your lightningd fell behind bitcoind's prune horizon, I found it easiest to connect to another remote full node that I had, using a reverse SSH proxy for port 8882 (RPC).
@egodigitus , @Sjors probably has more experience actually using pruned bitcoin with lightningd than us devs at this point, so if you have access to a trustable non-pruned full node, you could sync using that, then switch back to your pruned full node.
Theoretically it should be possible to sync in pruned mode and then start lightningd with a small --rescan value, and it should work. If however you run bitcoind without lightningd alongside for a prolonged time, it'll end up discarding blocks that lightningd hasn't seen yet and they run out of sync.
@cdecker would it be useful if bitcoind sent a ZMQ message when it’s about to prune? Perhaps consumers could register themselves via an RPC call and, before each prune, bitcoind would wait until all consumers say they’re done.
@Sjors I don't think so, ZMQ does not have any concept of a session, so we'd have to bolt on that on both sides, so that bitcoind knows when everybody has signed off. Also lightningd doesn't include ZMQ because it is incompatible with our event loop. The issue is also more prominent when lightningd isn't running, while bitcoind is, so it couldn't tell bitcoind not to prune.
We don't have a good story for pruned nodes just yet, maybe the only way of fixing that is to implement the bitcoin P2P protocol and ask peers for blocks that our bitcoind doesn't have.
I just saw this Block not available (pruned data) crash on a testnet node that I spinned up a few hours ago.
It was trying to fetch a block from 2018-03-21. It showed several thousand getblock 0000000...8df exited with status 1 messages before without crashing*. What could explain this block to be special?
I was careful to spin up the bitcoind node first and wait for its IBD to finish before launching c-lightning. I then opened a channel to it from another node and successfully made a payment to this node from the other node. The crash happened a little bit after that.
I was able to restart the node, generate a fresh invoice and pay that, so whatever the crash was didn't really seem fatal.
* = I didn't check for duplicates, but maybe it should remember these and not try again?
I didn't check for duplicates, but maybe it should remember these and not try again?
I assume this would lead to partial blindness to channels created before the node was launched. How bad is that exactly? In particular, does it hinder the ability to receive payments or only to spend? I only care about receiving funds for these nodes and don't mind opening fresh channels to facilitate the few times they need to spend.
My best guess is that it just is trying to sync, but that block was pruned away under its feet, so it'll try indefinitely. Possibly this has also something to do with IBD, i.e., the header is present but the block isn't yet. Later the block was pruned away under it and then it crashed since the behavior changed to a failing return code.
Must have missed that you had an active channel working in the daemon before the crash. In that case it might be because of an incoming gossip message, telling you about a channel that was anchored in that block, so that explains why the failure is non-fatal as well.
I find my node keeps falling out of the prune window because the getrawblock loop is realllly slow. I haven't used bitcoin's zmqpubrawblock before but perhaps it would be faster?
I heard rumours that in Bolt 1.1 SPV proofs are available via the p2p lightning gossip network, in which case you would never need historical blocks (since you node already checked the consensus rules).
Activity
Saibato commentedon May 14, 2018
@egodigitus have not used pruning lately but it's some important part.
and #1398 is a step forward, but we still state in README.md that pruned bitcoind is not supported.
also @Sjors wanted to test, no idea how far that is?
Sjors commentedon May 14, 2018
I've been running c-lightning with a pruned node for a while now. It seems to work fine, but I also make sure c-lightning doesn't get shut down for prolonged periods of time (beyond the prune horizon).
egodigitus commentedon May 14, 2018
Oh I initially started a bitcoind --prune and waited for complete sync.
Afterwards I installed and started lightningd
So it should work if:
Mmmh this eliminates the advantages of a pruned node somehow, like not needing a big harddrive...
ZmnSCPxj commentedon May 15, 2018
What happens when you execute the given command directly?
egodigitus commentedon May 15, 2018
ZmnSCPxj commentedon May 15, 2018
Well, there is the issue:
bitcoindpruned it beforelightningdcould process it. Whilelightningd"can" be made to work with prunedbitcoind, it requires extreme care not to letbitcoindgo forward sp fast thatlightningddrops below the pruning horizon. This is one reason why we still officially do not support prunedbitcoind: there is a significant amount of extra work you need to do (e.g. have a monitor program that checks thatlightningdis alive and if it dies, killbitcoind).Unfortunately it seems your only remaining option is to scrap your
bitcoindirectory and re-download from scratch, letbitcoindrun in non-pruning mode to catch up, letlightningdcatch up, and then prune. Which still requires that you have extra disk space.Alternately if you are willing to lose all the money you have in the
lightningdyou could just delete your.lightningdir, then run a newlightningd(which again you need to keep up-to-date with the prunedbitcoind).We do not officially support pruned
bitcoindyet, and while it is "possible" to get it running with prunedbitcoind, it is highly not recommended due to issues like this.egodigitus commentedon May 15, 2018
Ok thanks @ZmnSCPxj
Guess this issue can be closed
Sjors commentedon May 15, 2018
@egodigitus:
In step (1) you can sync with pruning enabled, so need need for a big disk (although it's a bit slow).
You can even start lightningd right away, as long as it stays on top of the initial blockchain download. However it's easier to start lightningd after the sync is done, and I get the impression (not measured) that lightningd slows down IBD.
To recover from a situation where your lightningd fell behind bitcoind's prune horizon, I found it easiest to connect to another remote full node that I had, using a reverse SSH proxy for port 8882 (RPC).
ZmnSCPxj commentedon May 15, 2018
@egodigitus , @Sjors probably has more experience actually using pruned bitcoin with lightningd than us devs at this point, so if you have access to a trustable non-pruned full node, you could sync using that, then switch back to your pruned full node.
cdecker commentedon May 17, 2018
Theoretically it should be possible to sync in pruned mode and then start
lightningdwith a small--rescanvalue, and it should work. If however you runbitcoindwithoutlightningdalongside for a prolonged time, it'll end up discarding blocks thatlightningdhasn't seen yet and they run out of sync.Sjors commentedon May 21, 2018
@cdecker would it be useful if bitcoind sent a ZMQ message when it’s about to prune? Perhaps consumers could register themselves via an RPC call and, before each prune, bitcoind would wait until all consumers say they’re done.
cdecker commentedon May 21, 2018
@Sjors I don't think so, ZMQ does not have any concept of a session, so we'd have to bolt on that on both sides, so that
bitcoindknows when everybody has signed off. Alsolightningddoesn't include ZMQ because it is incompatible with our event loop. The issue is also more prominent whenlightningdisn't running, whilebitcoindis, so it couldn't tellbitcoindnot to prune.We don't have a good story for pruned nodes just yet, maybe the only way of fixing that is to implement the bitcoin P2P protocol and ask peers for blocks that our
bitcoinddoesn't have.Sjors commentedon May 24, 2018
I just saw this
Block not available (pruned data)crash on a testnet node that I spinned up a few hours ago.It was trying to fetch a block from 2018-03-21. It showed several thousand
getblock 0000000...8df exited with status 1messages before without crashing*. What could explain this block to be special?I was careful to spin up the
bitcoindnode first and wait for its IBD to finish before launchingc-lightning. I then opened a channel to it from another node and successfully made a payment to this node from the other node. The crash happened a little bit after that.I was able to restart the node, generate a fresh invoice and pay that, so whatever the crash was didn't really seem fatal.
* =I didn't check for duplicates, but maybe it should remember these and not try again?Sjors commentedon May 24, 2018
I assume this would lead to partial blindness to channels created before the node was launched. How bad is that exactly? In particular, does it hinder the ability to receive payments or only to spend? I only care about receiving funds for these nodes and don't mind opening fresh channels to facilitate the few times they need to spend.
cdecker commentedon May 24, 2018
My best guess is that it just is trying to sync, but that block was pruned away under its feet, so it'll try indefinitely. Possibly this has also something to do with IBD, i.e., the header is present but the block isn't yet. Later the block was pruned away under it and then it crashed since the behavior changed to a failing return code.
Sjors commentedon May 25, 2018
But afaik it was already synced, otherwise it wouldn't have accepted the channel. So why is still looking at ancient blocks?
cdecker commentedon May 26, 2018
Must have missed that you had an active channel working in the daemon before the crash. In that case it might be because of an incoming gossip message, telling you about a channel that was anchored in that block, so that explains why the failure is non-fatal as well.
jb55 commentedon Dec 8, 2018
I find my node keeps falling out of the prune window because the getrawblock loop is realllly slow. I haven't used bitcoin's zmqpubrawblock before but perhaps it would be faster?
jb55 commentedon Dec 8, 2018
When testing on a 100Mbps connection, clightning fell out of range at block 35499 while bitcoin was at 245694 with a 10GB prune window
jb55 commentedon Dec 8, 2018
or perhaps something like bitcoin-iterate on the raw blockfiles? or would that be tricky to maintain @rustyrussell ?
at the very least it should speed up initial sync even for non-prune mode...
Sjors commentedon Dec 8, 2018
I heard rumours that in Bolt 1.1 SPV proofs are available via the p2p lightning gossip network, in which case you would never need historical blocks (since you node already checked the consensus rules).