You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Presently if one calls RPCs: synced_balance(), send() and then synced_balance() again, one might expect the balance to change but it doesn't.
The reason is that the send RPC only inserts the Tx in the mempool. It does not modify any MonitoredUtxo. MonitoredUtxo only reflect changes in confirmed blocks. As such, user would not see any change in their wallet balance after send(). neither synced balance nor unsynced balance.
I think what should be happening is that once a Tx is inserted into the mempool the wallet should be notified to keep track of any Utxos that came from it or go back to it.
I think the logical way to do this is for the wallet to keep a list of mempool_utxos which always contains the set of utxo presently in the mempool which came from or are destined for our wallet. Calculating unconfirmed balance then becomes:
self.monitored_utxos
.iter()
.filter_map(|u| if u.is_not_spent() { Some(u.native_coins()) else {None} ))
.chain(self.mempool_utxos)
.filter_map(|u| if u.is_not_spent() { Some(u.native_coins()) else {None} ))
the wallet would likely need to listen to mempool events in order to keep these lists fully in sync with mempool as utxos get expired, etc.
The text was updated successfully, but these errors were encountered:
Presently if one calls RPCs: synced_balance(), send() and then synced_balance() again, one might expect the balance to change but it doesn't.
The reason is that the send RPC only inserts the Tx in the mempool. It does not modify any MonitoredUtxo. MonitoredUtxo only reflect changes in confirmed blocks. As such, user would not see any change in their wallet balance after send(). neither synced balance nor unsynced balance.
I think what should be happening is that once a Tx is inserted into the mempool the wallet should be notified to keep track of any Utxos that came from it or go back to it.
I think the logical way to do this is for the wallet to keep a list of
mempool_utxos
which always contains the set of utxo presently in the mempool which came from or are destined for our wallet. Calculating unconfirmed balance then becomes:the wallet would likely need to listen to mempool events in order to keep these lists fully in sync with mempool as utxos get expired, etc.
The text was updated successfully, but these errors were encountered: