bitcoind_rpc!: bring back CheckPoints to Emitter

* `bdk_chain` dependency is added. In the future, we will introduce a
  separate `bdk_core` crate to contain shared types.
* replace `Emitter::new` with `from_height` and `from_checkpoint`
  * `from_height` emits from the given start height
  * `from_checkpoint` uses the provided cp to find agreement point
* introduce logic that ensures emitted blocks can connect with
  receiver's `LocalChain`
* in our rpc example, we can now `expect()` chain updates to always
  since we are using checkpoints and receiving blocks in order
This commit is contained in:
志宇
2023-10-07 00:56:01 +08:00
parent 57590e0a1f
commit 5f34df8489
4 changed files with 84 additions and 43 deletions

View File

@@ -9,13 +9,13 @@ edition = "2021"
# For no-std, remember to enable the bitcoin/no-std feature
bitcoin = { version = "0.30", default-features = false }
bitcoincore-rpc = { version = "0.17" }
bdk_chain = { path = "../chain", version = "0.5", default-features = false }
[dev-dependencies]
bdk_chain = { path = "../chain", version = "0.5", features = ["serde", "miniscript"] }
bitcoind = { version = "0.33", features = ["25_0"] }
anyhow = { version = "1" }
[features]
default = ["std"]
std = ["bitcoin/std"]
serde = ["bitcoin/serde"]
std = ["bitcoin/std", "bdk_chain/std"]
serde = ["bitcoin/serde", "bdk_chain/serde"]