Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement chain::Access trait #21

Closed
wants to merge 24 commits into from

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented Sep 9, 2022

Based on #8, #9, #10, #11.

Funnily enough I so far had overlooked implementing chain::Access. This PR fills this gap.

@tnull tnull marked this pull request as draft September 9, 2022 13:40
@tnull tnull changed the title 2022 09 chain access trait Implement chain::Access trait Sep 9, 2022
@tnull tnull force-pushed the 2022-09-chain-access-trait branch 3 times, most recently from 3cc9695 to dd97b78 Compare September 12, 2022 12:25
@tnull tnull marked this pull request as ready for review September 12, 2022 12:25
@tnull
Copy link
Collaborator Author

tnull commented Sep 12, 2022

Blocked on bitcoindevkit/rust-esplora-client#8, so currently based on my rust-esplora-client branch.

@tnull
Copy link
Collaborator Author

tnull commented Sep 14, 2022

Blocked on bitcoindevkit/rust-esplora-client#8, so currently based on my rust-esplora-client branch.

The change has been merged now, so not blocked anymore.

@tnull tnull force-pushed the 2022-09-chain-access-trait branch 5 times, most recently from f242dff to aec3a52 Compare September 30, 2022 14:01
// position, and finally feed them to the interface in order.
confirmed_txs.sort_unstable_by(
|(_, block_height1, _, pos1), (_, block_height2, _, pos2)| {
block_height1.cmp(&block_height2).then_with(|| pos1.cmp(&pos2))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also be implemented using sort_unstable_by_key: getlipa/lipa-lightning-lib@b2f521d

@tnull
Copy link
Collaborator Author

tnull commented Oct 20, 2022

Rebased on #26.

We migrate BDK and other remaining blocking parts to async.
}
}

impl<D> Access for ChainAccess<D>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to do this. Access doesn't really make sense to implement unless we're querying a local store, so implementing it for something other than local RPC/REST seems like we're sending the wrong signal.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I agree this is kind of counter-intuitive in the mobile case when we aim to default to the RGS + Electrum/Esplora model. However, as we probably soon add a server mode where we will default to P2P + Bitcoind', it may be awkward not to cover all options, i.e., allow to switch to P2P + Electrum/Esplora, if the user really wanted that for some reason?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think "cover all the bases" is a goal? Like, I guess the question is do we expect someone to be running on a "server" without a local bitcoind? Or, I suppose, do we want to support that - I'd strongly suggest a hard no. If you're running a large forwarding node you must run your own bitcoind, and we shouldn't support anything else.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, fair enough. Will close this for now and just implement Access vs bitcoind in the future 'server mode' feature.

@tnull tnull closed this Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants