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

[Feature request] Add timestamp when transaction has been boardcasted/seen first. #587

Closed
SeverinAlexB opened this issue Apr 18, 2022 · 8 comments
Assignees
Labels
good first issue Good for newcomers new feature New feature or request
Milestone

Comments

@SeverinAlexB
Copy link

SeverinAlexB commented Apr 18, 2022

Describe the feature
I am creating a tool that does batch payouts at the lowest fee possible. After 24hrs, if not confirmed yet, I want to execute a fee bump.
It would be very helpful to have a timestamp when the transactions has been boardcasted/first seen. At the moment, I need to create an additional database for that.

Best regards
Severin

@SeverinAlexB SeverinAlexB added the bug Something isn't working label Apr 18, 2022
@LLFourn
Copy link
Contributor

LLFourn commented Apr 18, 2022

I suppose we always "see" a transaction at a certain point and can record it so I think this is doable. I'll keep this in mind for bdk_core.

@danielabrozzoni danielabrozzoni added new feature New feature or request good first issue Good for newcomers and removed bug Something isn't working labels Jul 20, 2022
@remix7531
Copy link
Contributor

I will work on this issue.

@evanlinjin
Copy link
Member

I will work on this issue.

This is already in-progress with the work on the bdk core redesigned structures. #926 #943

@notmandatory
Copy link
Member

This issue should be fixed in #976, that PR includes the field CanonicalTx.observed_as of type ChainPosition which has a variant Unconfirmed(u64) which encapsulates when it was seen in the mempool.

@notmandatory
Copy link
Member

@SeverinAlexB please checkout current master branch now that #976 is merged and let us know if this gives you what you need.

@SeverinAlexB
Copy link
Author

Thx for merging! @gcomte @danielgranhao one of you guys wanna check? I don't work on that specific project anymore.

@danielgranhao
Copy link

Ty for the heads up @SeverinAlexB! We ended up developing an alternative solution so we have no feedback to provide.

@notmandatory
Copy link
Member

notmandatory commented Jun 22, 2023

@danielgranhao sorry you had to develope an alternative approach for your app, but if you want to take another look at how bdk version 1.0.0-alpha.1 will do it here are some details.

The Wallet::transactions() function now returns an Iterator of CanonicalTx:

pub fn transactions(

And CanonicalTx includes an observed_at field of type ChainPosition which will tell you if your transaction is Confirmed or Unconfirmed. If Confirmed you get which "Anchor" (chain tip) block we last saw it associated with. If Unconfirmed you get the unix timestamp of the last time we saw it in the mempool.

pub enum ChainPosition<A> {

Since this should cover the requested feature I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers new feature New feature or request
Projects
Archived in project
Development

No branches or pull requests

7 participants