Skip to content

Commit

Permalink
Use python decimal classes within the JSON parser to prevent floating…
Browse files Browse the repository at this point in the history
…-point errors causing a validation failure.

Observed in testnet e.g. 2023-10-07 below

INFO:root:***RESULTS***
Height of proof: 2530608
Block proven against: 000000000000009ebfcdeb127badf0e55bc7c3656e13acf85ccf792fbecef1a3
Claimed amount (sats): 21029955090998
Proven amount(sats): 21029955090997
INFO:root:IMPORTANT! Call this script with --reconsider to bring your bitcoin node back to tip when satisfied with the results
WARNING: More claimed 21029955090998 than proven 21029955090997
  • Loading branch information
shuckc committed Oct 9, 2023
1 parent ec117a2 commit 5685129
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion validate_reserves.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
import copy
from collections import Counter
import decimal
import json
import logging
import math
Expand Down Expand Up @@ -37,7 +38,7 @@ def wrapper(method, params=[], **kwargs):
r = requests.post(self.bitcoind, json=data, **kwargs)
logging.debug(r.text)
r.raise_for_status()
result = r.json()
result = r.json(parse_float=decimal.Decimal)
if result["error"] is not None:
raise JsonRPCException(result["error"])
return result["result"]
Expand Down

0 comments on commit 5685129

Please sign in to comment.