LLFourn / bdk_core_staging

Staging area for bdk_core initial development
15 stars 12 forks source link

Add example with compact block filters #153

Open danielabrozzoni opened 1 year ago

evanlinjin commented 1 year ago

I just had a brief look through, nothing seems apparent to me why balance would disappear after restart. Will properly debug later.

danielabrozzoni commented 1 year ago

Rebased on top of #157

(Still doesn't work though)

evanlinjin commented 1 year ago

Rebased on top of #157

(Still doesn't work though)

Did you also add on the fix mentioned in Discord?

evanlinjin commented 1 year ago

https://github.com/danielabrozzoni/bdk_core_staging/pull/2

I did a PR into yours fixing the balance disappearing after restart.

Looking good so far. In my opinion, the next steps for this PR:

Don't hold a mutable reference of the tracker when syncing. We need a structure (imo, like an iterator), where we only grab initial data from the tracker to create. Then it spits out data which the tracker can consume.

In my head, this thing that the CBF Iterator spits out can look something like this:

pub enum CbfData {
    RelevantBlock(bitcoin::Block),
    DisconnectedBlock(u32), // block height
}

Additionally, we need to somehow figure out how to properly do stop gap. We need logic that goes "uhh oh, we need more scripts for a rescan"!

danielabrozzoni commented 1 year ago

Don't hold a mutable reference of the tracker when syncing. We need a structure (imo, like an iterator), where we only grab initial data from the tracker to create. Then it spits out data which the tracker can consume.

Right, done! :)

Additionally, we need to somehow figure out how to properly do stop gap. We need logic that goes "uhh oh, we need more scripts for a rescan"!

I think this is pretty trivial to implement, but I'd prefer to do it after receiving some feedback on the current code, if possible

evanlinjin commented 1 year ago

@LLFourn I've tried removing the global CLI args but I couldn't find a way to do it. The "general commands" need to take in a client, and so the client needs to be initiated before our chain-specific commands.

LLFourn commented 1 year ago

@evanlinjin I see so you actually need to know "domains" for broadcasting too. So let's add the ability to add params to Send (rather than globally). Then pass those params through to the closure I made in #198 for broadcasting. Then you can create the client inside the closure.