mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-15 16:38:23 +01:00
test: add function to convert to json for height_or_hash params
This is necessary for bitcoin-cli because a string without quotes is not a valid json.
This commit is contained in:
@@ -8,6 +8,7 @@ import configparser
|
||||
from enum import Enum
|
||||
import argparse
|
||||
from datetime import datetime, timezone
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
@@ -1072,3 +1073,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||
|
||||
def has_blockfile(self, node, filenum: str):
|
||||
return (node.blocks_path/ f"blk{filenum}.dat").is_file()
|
||||
|
||||
def convert_to_json_for_cli(self, text):
|
||||
if self.options.usecli:
|
||||
return json.dumps(text)
|
||||
return text
|
||||
|
||||
Reference in New Issue
Block a user