Repository navigation
Add rpc command 'getunconfirmedbalance'... - #3369
Conversation
…alance Conflicts: src/rpcserver.cpp
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/6027b460e40e7769930d0e89f18f011fa0f6c262 for binaries and test log. |
|
What do you need this for? Unconfirmed balances are very dangerous things..... |
|
In one project that is working both with unconfirmed and raw transactions I need to monitor the unconfirmed funds in the hot wallet. First I tried approaches like and several variations. But this was not working like intended. If I remember correctly the problem was that outgoing transactions, while being unconfirmed, are still taken into account with the getbalance methods, leading to wrong results. |
|
I still don't understand what, at a high level, you were trying to accomplish. It sounds like maybe you should be using -walletnotify instead of polling getbalance. |
|
The unconfirmed balance is shown in the GUI, so in a way it makes sense to expose it on the RPC as well. And this looks like a pretty sane and minimal code addition as these things go. But indeed, relying on it to see if funds have arrived is dangerous. |
|
Thanks for your comments. I am running a site that works a lot with unconfirmed transactions, raw transactions and a very custom coin control implementation, so I am aware of the risks involved. |
|
I've got a feeling I'm going to regret this... but ACK. |
|
ACK |
6027b46 Add rpc command 'getunconfirmedbalance' to obtain total unconfirmed balance (Michael Bauer)
* Introduce SynchronousUpdatedBlockTip signal This version of UpdatedBlockTip mirrors the asynchronous behavior that we had before the introduction of asynchronous signal handling. * Fix tab spacing in validationinterface.cpp * Invoke CDeterministicMNManager::UpdatedBlockTip from validation thread It must be invoked synchronously as otherwise things become inconsistent. * Call CActiveMasternodeManager::Init with block index pindexNew in UpdatedBlockTip is not necessarily the current tip, so we shouldn't rely on it in Init(). This is due to the async nature of the UpdatedBlockTip invocation.
...to obtain total unconfirmed balance.
I am needing this frequently, so this might be useful for other people, too.