CoinAmt: improvements

- do strict type checking in initializer, forbid double initialization
- add dynamic decimal precision based on protocol
- dunder method fixes, cleanups
- JSON-RPC library now returns floats (i.e. amounts) as strings instead of Decimal,
  eliminating an extra conversion step
This commit is contained in:
The MMGen Project 2024-10-18 10:32:05 +00:00
commit 50fc415282
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
27 changed files with 220 additions and 109 deletions

View file

@ -74,7 +74,7 @@ async def main():
bdr = (cur['time'] - old['time']) / sample_size
t_rem = remaining * int(bdr)
sub = cur['subsidy'] * proto.coin_amt.satoshi
sub = proto.coin_amt(cur['subsidy'], from_unit='satoshi' if isinstance(cur['subsidy'], int) else None)
print(
f'Current block: {tip}\n'