(n, account_id)
| 180 | |
| 181 | |
| 182 | def account_balance(n, account_id): |
| 183 | moves = dedupe_moves(n.rpc.call('listcoinmoves_plugin')['coin_moves']) |
| 184 | chan_moves = [m for m in moves if m['account_id'] == account_id] |
| 185 | if len(chan_moves) == 0: |
| 186 | raise ValueError(f"No channel moves found for {account_id}. {moves}") |
| 187 | m_sum = Millisatoshi(0) |
| 188 | for m in chan_moves: |
| 189 | m_sum += Millisatoshi(m['credit_msat']) |
| 190 | m_sum -= Millisatoshi(m['debit_msat']) |
| 191 | return m_sum |
| 192 | |
| 193 | |
| 194 | def extract_utxos(moves): |