-
Notifications
You must be signed in to change notification settings - Fork 182
Allow sendmany to be used without an account specified #1158
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
Allow sendmany to be used without an account specified #1158
Conversation
Ha. This solves an issue I opened about this very thing a long, long time ago! :) In fact it is issue #793, which can be closed if we agree this is adequate and merge it. I am good with the change as is... |
I'd prefer it, if instead throwing a JSONRPCERROR error for the "*" character, it executes the code block you added. This would preserve the current functionality of the empty string "". |
can remove and allow * to be treated as "" or can make empty account name as the json error and make "*" treated as send from my changes |
Empty account string should still work like currently. I propose your logic to be triggered by "*". |
src/rpcwallet.cpp
Outdated
@@ -94,7 +94,7 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) | |||
string AccountFromValue(const UniValue& value) | |||
{ | |||
string strAccount = value.get_str(); | |||
if (strAccount == "*") | |||
if (strAccount.empty()) |
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.
This backfired. Now empty string labels cannot be selected anymore. I think for now it's best to revert to the previous state with ""
selecting all coins and "*"
not allowed and at a later point port bitcoin's GetLegacyBalance
. Sorry for my opinion slalom.
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 also tested it with the previous state of using ""
to select all, and it worked fine.
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.
haha yea i realised that when u said that whoops i can opt out of AccountFromValue in that function lol
I'd just revert it back to 11e9846 , the accounts are anyway not used for coin selection. The |
a858870
to
11e9846
Compare
reverted to |
int64_t nBalance; | ||
|
||
if (bFromAccount) | ||
nBalance = GetAccountBalance(strAccount, nMinDepth); |
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.
nBalance is now uninitialized. What should it be if bFromAccount is false? 0?
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.
Ugh, how did I miss this. Yes, should be 0.
Added: - Linux nodes can now stake superblocks using forwarded contracts #1060 (@tomasbrod). Changed: - Replace interest with constant block reward #1160 (@tomasbrod). Fork is set to trigger at block 1420000. - Raise coinstake output count limit to 8 #1261 (@tomasbrod). - Port of Bitcoin hash implementation #1208 (@jamescowens). - Minor canges for the build documentation #1091 (@Lenni). - Allow sendmany to be used without an account specified #1158 (@Foggyx420). Fixed: - Fix `cpids` and `validcpids` not returning the correct data #1233 (@Foggyx420). - Fix `listsinceblock` not showing mined blocks to change addresses #501 (@Foggyx420). - Fix crash when raining using a locked wallet #1236 (@Foggyx420). - Fix invalid stake reward/fee calculation (@jamescowens). - Fix divide by zero bug in `getblockstats` RPC #1292 (@Foggyx420). - Bypass historical bad blocks on testnet #1252 (@Quezacoatl1). - Fix MacOS memorybarrier warnings #1193 (@ghost). Removed: - Remove neuralhash from the getpeerinfo and node stats #1123 (@Foggyx420). - Remove obsolete NN code #1121 (@Foggyx420). - Remove (lower) Mint Limiter #1212 (@tomasbrod).
Tested on testnet. I incorporated the non account method for determining balance and if it was mature and spendable. This suffices thou if @denravonska or @TheCharlatan want changes i'll make them.
sendmany testacct '{"n3C1AM2myBdfhKjWegutHCEJBSXxyTBsa2":1.1,"mrWELwYJzPR4PLNQUSksCd9B8LnCAVEnJn":1.1}' 1
9176295fbcdee62e8175b006ab743b8eb89d024ac46eacaa4954e6d88b52a72f
sendmany '' '{"n3C1AM2myBdfhKjWegutHCEJBSXxyTBsa2":2.1,"mrWELwYJzPR4PLNQUSksCd9B8LnCAVEnJn":2.1}' 1
7bdd370bf4d44d40bfdde1140377511b7e2ada5feb2d00b8b7af490db16fa8c3
This addresses #1152