Skip to content

Conversation

iFoggz
Copy link
Member

@iFoggz iFoggz commented Jun 9, 2018

  • Allow sendmany to send transaction with or without an account specified.
  • Update help for this purpose.

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

@jamescowens
Copy link
Member

jamescowens commented Jun 13, 2018

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...

@TheCharlatan
Copy link
Contributor

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 "".

@iFoggz
Copy link
Member Author

iFoggz commented Jun 15, 2018

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

@TheCharlatan
Copy link
Contributor

Empty account string should still work like currently. I propose your logic to be triggered by "*".

@denravonska denravonska requested a review from TheCharlatan June 19, 2018 09:36
@@ -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())
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Member Author

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

@TheCharlatan
Copy link
Contributor

I'd just revert it back to 11e9846 , the accounts are anyway not used for coin selection. The "*" character is not working properly, since that is not the only location for it to be checked. Btw, I talked to some Bitcoin Core devs, and they opted to use the empty string "`" to select all labels beginning in v0.17 , so 11e9846 would be compatible with the future rebased api.

@iFoggz iFoggz force-pushed the sendmanybalanceissue branch from a858870 to 11e9846 Compare June 22, 2018 19:47
@iFoggz
Copy link
Member Author

iFoggz commented Jun 22, 2018

reverted to 11e9846

@TheCharlatan TheCharlatan merged commit 7637542 into gridcoin-community:development Jul 8, 2018
int64_t nBalance;

if (bFromAccount)
nBalance = GetAccountBalance(strAccount, nMinDepth);
Copy link
Member

@denravonska denravonska Jul 19, 2018

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?

Copy link
Contributor

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.

@denravonska denravonska added this to the Betsy milestone Oct 19, 2018
denravonska added a commit that referenced this pull request Oct 19, 2018
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).
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.

4 participants