Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memo plotid #17856

Merged
merged 7 commits into from Apr 30, 2024
16 changes: 13 additions & 3 deletions chia/plotting/create_plots.py
Expand Up @@ -202,19 +202,29 @@ async def create_plots(
# The plot id is based on the harvester, farmer, and pool keys
if keys.pool_public_key is not None:
plot_id: bytes32 = calculate_plot_id_pk(keys.pool_public_key, plot_public_key)
plot_memo: bytes32 = stream_plot_info_pk(keys.pool_public_key, keys.farmer_public_key, sk)
plot_memo: bytes = stream_plot_info_pk(keys.pool_public_key, keys.farmer_public_key, sk)
else:
assert keys.pool_contract_puzzle_hash is not None
plot_id = calculate_plot_id_ph(keys.pool_contract_puzzle_hash, plot_public_key)
plot_memo = stream_plot_info_ph(keys.pool_contract_puzzle_hash, keys.farmer_public_key, sk)

if args.plotid is not None:
log.info(f"Debug plot ID: {args.plotid}")
plot_id = bytes32(bytes.fromhex(args.plotid))
# Check if args.memo is of type bytes and convert it to a string if so
if isinstance(args.plotid, bytes):
plot_str = args.plotid.hex() # Convert bytes to hex string
else:
plot_str = args.plotid
plot_id = bytes32.fromhex(plot_str)

if args.memo is not None:
log.info(f"Debug memo: {args.memo}")
plot_memo = bytes32.fromhex(args.memo)
# Check if args.memo is of type bytes and convert it to a string if so
if isinstance(args.memo, bytes):
memo_str = args.memo.hex() # Convert bytes to hex string
else:
memo_str = args.memo
plot_memo = bytes.fromhex(memo_str)

dt_string = datetime.now().strftime("%Y-%m-%d-%H-%M")

Expand Down