【问题标题】:What is "Custom Program Error 0xa7" in anchor?锚点中的“自定义程序错误 0xa7”是什么?
【发布时间】:2021-12-26 03:36:12
【问题描述】:

我的 Anchor 程序给了我一个Transaction simulation failed: Error processing Instruction 1: custom program error: 0xa7,日志中没有任何用处。

我什至如何开始调试呢?

【问题讨论】:

    标签: anchor solana anchor-solana


    【解决方案1】:

    自定义程序错误 0xa7 是 Error: 167: The given account is not owned by the executing program.

    如果您传入的帐户应该归某个程序所有,但实际上并非如此,则可能会发生这种情况。

    如果您忘记将 declare_id!(/* ... */) 设置为您尝试点击的程序 ID,这可能会意外发生。

    考虑记录您在 javascript 客户端中使用的程序 ID:

    console.log(program.programId)
    

    然后查看它是否与您的 target/idl/yourprogram.json 文件中的公钥匹配。

    【讨论】:

    • 这里有一些关于这个的查询,请参阅问题和代码github.com/…
    猜你喜欢
    • 1970-01-01
    • 2020-11-14
    • 1970-01-01
    • 1970-01-01
    • 2022-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多