arcbtc / M5StackSats

A bitcoin point of sale terminal using the ESP32 based M5Stack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Room77: Check Inbound Capacity

rootzoll opened this issue · comments

The POS sould check the remaining inbound capacity (biggest inbound on any channel open). At least when bar tender puts in amount that is higher than that limit it should let know that this amount is not possible at the moment and give options: make on-chain, open channel to node or manage inbound capacity.

commented

Added x2 functions. nodedetails, which returns the pubkey, channels, etc, and nodecheck, which takes the pubkey and checks capacity.

commented

Both run in setup, to use what nodecheck returns:

commented

JsonObject node = doc["node"];
long node_last_update = node["last_update"]; // 1567549590
const char* node_pub_key = node["pub_key"]; // "03d34c207eecb9045228c9f835d7a2ed950f2ba03a4f173ed6fd3a895cf00de201"
const char* node_alias = node["alias"]; // "room77"

const char* node_addresses_0_network = node["addresses"][0]["network"]; // "tcp"
const char* node_addresses_0_addr = node["addresses"][0]["addr"]; // "someip:9777"

const char* node_color = node["color"]; // "#68f442"

int num_channels = doc["num_channels"]; // 32
const char* total_capacity = doc["total_capacity"]; // "80037668"