如何解决通过deno RPC发送带有sendrawtransaction的txhash始终失败
我试图通过deno中的RPC实现sendrawtransaction,但每次尝试均失败时,但是如果我使用bitcoin-cli手动运行它就会通过。请注意,其他命令也可以使用。
async sendCoin(
amount: number,from: string[],to: string,priority: number,walletName?: string
) {
const remote = this.createConnection(walletName);
const unspent: Unspent[] = await remote.listunspent(1,99999999,from);
const txids = this.sortTxToSpendFrom(unspent,amount);
if (txids === null) return {
status: false,reason: 'insufficient funds'
};
const rawTx = await remote.createrawtransaction(txids,{[to]: amount});
const privateKeys = await this.getPrivateKeys(remote,from);
const signedTx = await remote.signrawtransactionwithkey(rawTx,privateKeys);
const txFee = await this.calcTxFees(priority,remote);
const txHash = await remote.sendrawtransaction(signedTx.hex);
const decoded = await remote.decoderawtransaction(signedTx.hex);
return decoded;
}
我不确定为什么会这样,但是我猜有一个参数丢失或signedTx.hex
长度太长而无法发送。我不确定是什么原因。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。