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

Get multiple balances with both acknowledged and saved balances #8

Closed
PaulBernier opened this issue Jan 30, 2019 · 6 comments
Closed
Assignees
Labels

Comments

@PaulBernier
Copy link
Contributor

Have an API similar to factomd multiple-fct-balances
that would return the temporary balance of an address (acknowledged balance vs saved).

Motivation

This is very useful for the end user to have the temporary balance of an address before the block is saved. That allows all UIs to be "reactive" to transactions, otherwise having to wait up to 10 minutes to see what has happened is not a good user experience.

How it would work I think would be for fatd to poll the pending entries, filter any FAT transactions and apply those on top of the saved state.

@PaulBernier PaulBernier added enhancement New feature or request fatd labels Jan 30, 2019
@drkatz
Copy link
Member

drkatz commented Feb 8, 2019

@PaulBernier How do you envision this fitting in with other API calls that use unconfirmed data? Using unconfirmed balances/txs of addresses is very useful many extant calls, not just this purpose built one:

  • get-balance (single address version of above)
  • get-nf-balance
  • get-transaction
  • get-stats (circ. supply, burned, last tx timestamp which would otherwise be 0-10 mins off, etc)

Personally I would prefer either a fatd startup flag or param you could submit with your RPC request for those methods.

@AdamSLevy
Copy link
Collaborator

AdamSLevy commented Feb 9, 2019 via email

@drkatz
Copy link
Member

drkatz commented Feb 10, 2019

@AdamSLevy Just returning both mutates and clutters the responses a bunch, if I'm taking your meaning correctly. For example, there would have to be confirmed* and unconfirmed* versions of many fields in get-stats, get-balance would no longer return an integer 😢 get-nf-balance would actually return 2 arrays(?!?). Thoughts?

@AdamSLevy
Copy link
Collaborator

Good point.

So how about an optional request parameter as you suggested?

@drkatz
Copy link
Member

drkatz commented Mar 23, 2019

@AdamSLevy That would be just fine 👍

AdamSLevy added a commit that referenced this issue Sep 10, 2019
The long awaited pending transaction support is here. This
implementation fully leverages the existing validation and database
code. No new tables, nor schema changes were required. When pending
transactions are enabled (default), when a pending transaction for a
tracked change is detected, a new in memory copy of that chains database
is created. This in memory database uses a shared cache so a pool of
read only connections can also be opened to it. A session is used to
track the changes to the in memory database as pending entries are
applied to it. When the next EBlock is published, the inverse of the
session's changeset is used to rollback all pending txs on the in memory
db. A new session on the main database is used to generate a changeset
for applying this EBlock. This session is kept open until another
pending entry is available for that database, at which point this
session's changeset is used to sync the in-memory database with the main
database. One advantage to this approach is that is allows for full code
reuse of the validation code. The downside is that a full copy of each
chain database must be kept around in memory. The -disablepending flag
has been added to allow resource constrained systems to not track
pending transactions.

re #14 #8
@AdamSLevy AdamSLevy self-assigned this Sep 11, 2019
@AdamSLevy
Copy link
Collaborator

The "includepending" param can be used to request pending balances

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants