Chia-Network / chia-exporter

RPC/Websocket based metrics exporter for Chia
Apache License 2.0
39 stars 10 forks source link

FR - Get Pooling Wallet Balance #99

Open bhorvitz opened 1 year ago

bhorvitz commented 1 year ago

Confirmed with clydewallace22 in #support on discord that if self-pooling and a Pool Wallet has Wallet ID 2, chia_wallet_confirmed_balance{wallet_id="2"} will return a 0 balance, even if there is xch in the wallet.

Additionally, confirmed that chia_wallet_confirmed_balance{wallet_type="9"} also returns 0 if there is a balance in the pooling wallet.

FR is a metric to be able to retrieve Pool Wallet balance

cmmarslender commented 1 year ago

@bhorvitz Can you provide the output of chia rpc wallet get_wallet_balance '{"wallet_id":2}' (update wallet ID to the id of the pooling wallet, if it isn't actually 2).

bhorvitz commented 1 year ago

Here you can see the RPC query and exporter data don't align: $ chia rpc wallet get_wallet_balance '{"wallet_id":2}' { "success": true, "wallet_balance": { "confirmed_wallet_balance": 1750000000000, "fingerprint": 1206818994, "max_send_amount": 0, "pending_change": 0, "pending_coin_removal_count": 0, "spendable_balance": 1750000000000, "unconfirmed_wallet_balance": 1750000000000, "unspent_coin_count": 2, "wallet_id": 2, "wallet_type": 9 } }

image

But if I look at a different wallet_id they do: $ chia rpc wallet get_wallet_balance '{"wallet_id":5}' { "success": true, "wallet_balance": { "asset_id": "a628c1c2c6fcb74d53746157e438e108eab5c0bb3e5c80ff9b1910b3e4832913", "confirmed_wallet_balance": 42000, "fingerprint": 1206818994, "max_send_amount": 42000, "pending_change": 0, "pending_coin_removal_count": 0, "spendable_balance": 42000, "unconfirmed_wallet_balance": 42000, "unspent_coin_count": 1, "wallet_id": 5, "wallet_type": 6 } }

image
bhorvitz commented 1 year ago

This gets more interesting. Now there is more balance in the Pool Wallet (added current time for alignment with the Grafana output):

$ date
Thu Jul 20 11:12:23 AM PDT 2023
$ chia rpc wallet get_wallet_balance '{"wallet_id":2}'
{
    "success": true,
    "wallet_balance": {
        "confirmed_wallet_balance": 5250000000000,
        "fingerprint": 1206818994,
        "max_send_amount": 0,
        "pending_change": 0,
        "pending_coin_removal_count": 0,
        "spendable_balance": 5250000000000,
        "unconfirmed_wallet_balance": 5250000000000,
        "unspent_coin_count": 4,
        "wallet_id": 2,
        "wallet_type": 9
    }
}

It shows a previous balance:

image
cmmarslender commented 1 year ago

I suspect the event we listen to to know to re-check the wallet balances isn't fired when there is a new reward available to claim in the pooling wallets, but will have to dig in a bit to confirm.