Bitcoin-Core
TX decode failed 輸出映射末尾缺少分隔符:iostream 錯誤
import requests url = "http://127.0.0.1:18332/wallet/w3" headers = { 'Authorization': 'Basic dXNlcjpwYXNz', 'Content-Type': 'text/plain' } def combinetx(): payload = "{\"jsonrpc\": \"1.0\",\r\n \"id\": \"test\",\r\n \"method\": \"combinepsbt\",\r\n \"params\": [[\"" + str(round_spsbt_list[0]) + "\",\"" + str(round_spsbt_list[1]) + "\",\"" + str(round_spsbt_list[2]) + "\",\"" + str(round_spsbt_list[3]) + "\",\"" + str(round_spsbt_list) + "\"]]\r\n}" response = requests.request("POST", url, headers=headers, data=payload) combined_psbt = response.json() return combined_psbt if __name__=="__main__": round_spsbt_list = [] round_spsbt_list.append("cHNidP8BAP1yAQIAAAAFtMaoJYcXvOG5L3Yaz3YyS7gIt4h5/zzOrRRS3hrVvwoAAAAAAP////+o83geaSm4L76KToIUl5MiZqLAUbIDJLq6DWrjP/3b8AEAAAAA/////zEF3CXIvVHpIa7No1s1yg+KtyOfXTRSyWnOdXMfzcDwAQAAAAD/////wMa4XAgnU+39Ien+KG9rYtv8bLMNYakmZyY/QFfwLRcAAAAAAP/////5M42ID6uLmQTb2tnFHnN7UMpnDD25uN8ZX7A+GNSM3QEAAAAA/////wV4xwEAAAAAABYAFCdv635VGsRUX2ATAf2wkSkYER9qeMcBAAAAAAAWABSkEuQKyglw2lwyDpHhw6VwjMuncXjHAQAAAAAAFgAUy/I/6r4EbPYgMJBacHw1783WY3F4xwEAAAAAABYAFBwQ03JK7zC5CHSRLjwzPk8pdeYyeMcBAAAAAAAWABR0ykR92RB3+dhLNsor+r7Uc01FzwAAAAAAAQBxAgAAAAG+qpMXZCy6tBuUlgo8JD0GVXKp60FkhwDeg2sF1fkFkwMAAAAA/f///wLo9wEAAAAAABYAFFfLA5xarC/w/SxeMDQ5tuXrYJLUWwMAAAAAAAAWABRfPf//hwMjHB4OKj87cU19XOSh7yOWAQABAR/o9wEAAAAAABYAFFfLA5xarC/w/SxeMD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YzREZzfMuazhpzotdvvAiAPCWSVqmznYaEB00a1qa4W/g2w4g3m5IEx0HfeMQi0qQEhA6xdlxrjYl9Yw+9bysRoJWU4gru2pGb4TXImSJ3YdqFRAAAAAAAAAfAA") round_spsbt_list.append("cHNidP8BAP1yAQIAAAAFqPN4HmkpuC++ik6CFJeTImaiwFGyAyS6ug1q4z/92/ABAAAAAP////8xBdwlyL1R6SGuzaNbNcoPircjn100UslpznVzH83A8AEAAAAA/////8DGuFwIJ1Pt/SHp/ihva2Lb/GyzDWGpJmcmP0BX8C0XAAAAAAD/////+TONiA+ri5kE29rZxR5ze1DKZww9ubjfGV+wPhjUjN0BAAAAAP////+0xqglhxe84bkvdhrPdjJLuAi3iHn/PM6tFFLeGtW/CgAAAAAA/////wV4xwEAAAAAABYAFLcQbdS3CEMZ1vhY4JCj6e0NEReUeMcBAAAAAAAWABQMCawHBFux66DX3IB4n2/SSuKxznjHAQAAAAAAFgAURtX3F5xGEov3UR9HHgwBnQcfU/R4xwEAAAAAABYAFJSx4tdCHmslLfvEd3U+I0WlCLBweMcBAAAAAAAWABSyCjTppFl/e6/k0WjGaWychswpsAAAAAAAAAABAHECAAAAAb6qkxdkLLq0G5SWCjwkPQZVcqnrQWSHAN6DawXV+QWTBQAAAAD9////AgjJAQAAAAAAFgAUuuDTig8PWRpQc7uz8c5h8V7y6b5DBwAAAAAAABYAFIpMjQrUnQhwGz/J+bq+po7CSUkfI5YBAAEBHwjJAQAAAAAAFgAUuuDTig8PWRpQc7uz8c5h8V7y6b4BCGsCRzBEAiBFLNLcq8Ytt5CSJYSFCvVDD76wzMhAue4QUtbT75kN/QIgKT2/elTtCk1TwcQ9NhZAIJq4hvmhmoa96l0PIJB40T0BIQMCXcEsICSSfMust/OD2aGn0HCar3PHsit5S4KSfzvoGgAAAAAAAAAA") round_spsbt_list.append("cHNidP8BAP1yAQIAAAAFqPN4HmkpuC++ik6CFJeTImaiwFGyAyS6ug1q4z/92/ABAAAAAP////8xBdwlyL1R6SGuzaNbNcoPircjn100UslpznVzH83A8AEAAAAA/////8DGuFwIJ1Pt/SHp/ihva2Lb/GyzDWGpJmcmP0BX8C0XAAAAAAD/////+TONiA+ri5kE29rZxR5ze1DKZww9ubjfGV+wPhjUjN0BAAAAAP////+0xqglhxe84bkvdhrPdjJLuAi3iHn/PM6tFFLeGtW/CgAAAAAA/////wV4xwEAAAAAABYAFLcQbdS3CEMZ1vhY4JCj6e0NEReUeMcBAAAAAAAWABQMCawHBFux66DX3IB4n2/SSuKxznjHAQAAAAAAFgAURtX3F5xGEov3UR9HHgwBnQcfU/R4xwEAAAAAABYAFJSx4tdCHmslLfvEd3U+I0WlCLBweMcBAAAAAAAWABSyCjTppFl/e6/k0WjGaWychswpsAAAAAAAAAAAAQBxAgAAAAG+qpMXZCy6tBuUlgo8JD0GVXKp60FkhwDeg2sF1fkFkwEAAAAA/f///wJDBwAAAAAAABYAFLu1W0sTabM1lGV9zJCKsXHdOIUv8MwBAAAAAAAWABRGcfARTModqKqAdQ0KSUbzF1ToaCOWAQABAR/wzAEAAAAAABYAFEZx8BFMyh2oqoB1DQpJRvMXVOhoAQhrAkcwRAIgf4P4zLLtqVXdN7Ch4otJpgTegBIZny+xzVqGc9ju8d0CIBoR67P+Jcqk4UzZZPaLfu3lXg6eoNHVipyZ/MjHALh2ASEDRZkogQu2VhkOw2ykkvHpye2EzGrgmg0unGIWi+4nRbgAAAAAAAAA") ctx = combinetx() print(ctx)
此錯誤的原因是什麼以及如何解決?我理解錯誤說“輸出映射末尾缺少分隔符”,但是我檢查了所有內容,但找不到包括其他功能在內的程式碼有任何問題。
錯誤:
{'result': None, 'error': {'code': -22, 'message': 'TX decode failed Separator is missing at the end of an output map: iostream error'}, 'id': 'test'}
這意味著 PSBT 格式不正確,並且缺少 PSBT 中每個部分末尾所需的分隔符。當最後一個輸出映射缺少分隔符時,通常會出現此錯誤。造成這種情況的一個常見原因是在選擇 PSBT 以複製並粘貼到另一個程序時意外錯過了 PSBT 的最後一個或兩個字元。