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

GetUnclaimedGas Generic #241

Closed
vncoelho opened this issue May 15, 2020 · 2 comments · Fixed by #243
Closed

GetUnclaimedGas Generic #241

vncoelho opened this issue May 15, 2020 · 2 comments · Fixed by #243

Comments

@vncoelho
Copy link
Member

vncoelho commented May 15, 2020

Perhaps we need extra calls on RPCServer plugin such as generic GetUnclaimedGas call apart of just the the one linked to the wallet itself:

private JObject GetUnclaimedGas(JArray _params)
{
CheckWallet();
BigInteger gas = BigInteger.Zero;
using (SnapshotView snapshot = Blockchain.Singleton.GetSnapshot())
foreach (UInt160 account in wallet.GetAccounts().Select(p => p.ScriptHash))
{
gas += NativeContract.NEO.UnclaimedGas(snapshot, account, snapshot.Height + 1);
}
return gas.ToString();
}

The one linked to the account should be something like GetWalletUnclaimedGas

@roman-khimov
Copy link
Contributor

IMO this call should just be extended to work with any addresses, getting this data is so cheap on Neo 3 that limiting this method to wallet-only addresses makes no sense to me. And I don't think we need two methods here, one working for any address is enough.

In fact, that's the model neo-go uses for getunclaimed on Neo 2, answering this call for any addresses known to the chain and it works fine (even though it costs something in terms of additional UTXO tracking).

@vncoelho
Copy link
Member Author

Agree with you @roman-khimov

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 a pull request may close this issue.

2 participants