Chia-Network / chia-blockchain

Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Apache License 2.0
10.81k stars 2.02k forks source link

[Bug] 'chia rpc wallet push_tx' accepts only hex encoded spend_bundle #18734

Open DrakoPensulo opened 1 week ago

DrakoPensulo commented 1 week ago

What happened?

'chia rpc wallet push_tx' accepts only request (or json file) in the format '{"spend_bundle":"hex encoded spend bundle"}' It does not accept dict encoded spend bundles of the form '{"spend_bundle": { "coin_spends":[ ... ] ... } }'

Version

2.4.4

What platform are you using?

Windows

What ui mode are you using?

CLI

Relevant log output

chia rpc wallet push_tx -j spend80_4.json
Request failed: RPC response failure: {"error": "'dict' object has no attribute 'startswith'", "success": false, "traceback": "Traceback (most recent call last):\n  File \"chia\\rpc\\util.py\", line 84, in inner\n  File \"chia\\rpc\\wallet_rpc_api.py\", line 630, in push_tx\n  File \"chia\\util\\byte_types.py\", line 8, in hexstr_to_bytes\nAttributeError: 'dict' object has no attribute 'startswith'\n"}
wjblanke commented 1 week ago

quex is this a regression? It looks like startswith expects a string

Quexington commented 6 days ago

As far as I can tell, this is not a regression but it's not a bad idea to support the behavior regardless.