1
0
mirror of https://github.com/romanz/electrs.git synced 2024-11-19 09:54:09 +01:00

Don't fail blockchain.headers.subscribe on initial sync

This commit is contained in:
Roman Zeyde 2020-11-08 11:58:12 +02:00
parent 4af4bcaaf6
commit f9c7a06ade
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB

View File

@ -332,7 +332,10 @@ impl Rpc {
let map = self.index.map();
let chain = map.chain();
Ok(match chain.last() {
None => bail!("empty chain"),
None => {
subscription.tip = Some(BlockHash::default());
json!({}) // no tip when waiting for index sync
}
Some(tip) => {
subscription.tip = Some(*tip);
let header = serialize(map.get_by_hash(tip).unwrap());