def clone_cache_from_node_1(cachedir, from_num=4):
    " Clones cache subdir from node 1 to nodes from 'from_num' to MAX_NODES"

    def copy_and_overwrite(from_path, to_path):
        if os.path.exists(to_path):
            shutil.rmtree(to_path)
        shutil.copytree(from_path, to_path)
    assert (from_num < MAX_NODES)
    node_0_datadir = os.path.join(get_datadir_path(cachedir, 0), 'regtest')
    for i in range(from_num, MAX_NODES):
        node_i_datadir = os.path.join(get_datadir_path(cachedir, i), 'regtest')
        for subdir in ['blocks', 'chainstate', 'sporks']:
            copy_and_overwrite(os.path.join(node_0_datadir, subdir), os.path.join(node_i_datadir, subdir))
        initialize_datadir(cachedir, i)
Clones cache subdir from node 1 to nodes from 'from_num' to MAX_NODES
def clone_cache_from_node_1(cachedir, from_num=4):
    " "

    def copy_and_overwrite(from_path, to_path):
        if os.path.exists(to_path):
            shutil.rmtree(to_path)
        shutil.copytree(from_path, to_path)
    assert (from_num < MAX_NODES)
    node_0_datadir = os.path.join(get_datadir_path(cachedir, 0), 'regtest')
    for i in range(from_num, MAX_NODES):
        node_i_datadir = os.path.join(get_datadir_path(cachedir, i), 'regtest')
        for subdir in ['blocks', 'chainstate', 'sporks']:
            copy_and_overwrite(os.path.join(node_0_datadir, subdir), os.path.join(node_i_datadir, subdir))
        initialize_datadir(cachedir, i)