-
Notifications
You must be signed in to change notification settings - Fork 36.9k
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
cli: display multiwallet total balance in -getinfo #19092
cli: display multiwallet total balance in -getinfo #19092
Conversation
Concept ACK. Could update doc? |
Thanks @promag. Added a release note update. |
This is
nit, I wonder if this should document the result. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Made an attempt at improving it. |
57f771b
to
aba6f91
Compare
"balance" seems to perhaps oversimplify things... Maybe "total_balance"? |
ฉันจะทราบได้อย่างไร่่่่ะว่ายอดเงินอยุ่ทึ่ใหน ช่วยแนะนำด้วยค่ะ |
"I can know exactly what the balance is. Please help." I'll take that as a Concept ACK :) |
That was my initial thought as well. @promag WDYT? |
Also looks fine to me. I just mentioned |
aba6f91
to
c37fab2
Compare
fbd14f5
to
d1ae2e5
Compare
static CAmount AmountFromValue(const UniValue& value) | ||
{ | ||
CAmount amount{0}; | ||
if (!ParseFixedPoint(value.getValStr(), 8, &amount)) | ||
throw std::runtime_error("Invalid amount"); | ||
if (!MoneyRange(amount)) | ||
throw std::runtime_error("Amount out of range"); | ||
return amount; | ||
} | ||
|
||
static UniValue ValueFromAmount(const CAmount& amount) | ||
{ | ||
bool sign{amount < 0}; | ||
int64_t n_abs{sign ? -amount : amount}; | ||
int64_t quotient{n_abs / COIN}; | ||
int64_t remainder{n_abs % COIN}; | ||
return UniValue(UniValue::VNUM, strprintf("%s%d.%08d", sign ? "-" : "", quotient, remainder)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get these into the libbitcoin_util.a
module? I think this is the third copy...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, third one. Agreed, a good follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not in this PR or in a base PR especially considering there aren't ACKs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that refactoring would best be done in a separate PR.
Github-Pull: bitcoin#19092 Rebased-From: e0c8c8d
Github-Pull: bitcoin#19092 Rebased-From: f47067c
Github-Pull: bitcoin#19092 Rebased-From: fca89dc
Github-Pull: bitcoin#19092 Rebased-From: d1ae2e5
Github-Pull: bitcoin#19092 Rebased-From: e0c8c8d
Github-Pull: bitcoin#19092 Rebased-From: f47067c
Github-Pull: bitcoin#19092 Rebased-From: fca89dc
Github-Pull: bitcoin#19092 Rebased-From: d1ae2e5
d1ae2e5
to
3bed024
Compare
3bed024
to
08ac1ab
Compare
Closing, there are many open PRs and this has no ACKs. At least this PR was pulled into other Bitcoin implementations, so it will be useful for those users. |
Github-Pull: bitcoin#19092 Rebased-From: e0c8c8d
Github-Pull: bitcoin#19092 Rebased-From: f47067c
Github-Pull: bitcoin#19092 Rebased-From: fca89dc
Github-Pull: bitcoin#19092 Rebased-From: d1ae2e5
Github-Pull: bitcoin#19092 Rebased-From: bbf0afa
Github-Pull: bitcoin#19092 Rebased-From: 8e6c8d6
Github-Pull: bitcoin#19092 Rebased-From: 414804e
Github-Pull: bitcoin#19092 Rebased-From: 08ac1ab
Github-Pull: bitcoin#19092 Rebased-From: bbf0afa
Github-Pull: bitcoin#19092 Rebased-From: 8e6c8d6
Github-Pull: bitcoin#19092 Rebased-From: 414804e
Github-Pull: bitcoin#19092 Rebased-From: 08ac1ab
Per review suggestion in #18594 (comment), this PR adds a
total_balance
field for-getinfo
in multiwallet mode.Updated help:
Credit to João Barbosa for the suggestion.