根据文档(http://godoc.org/github.com/btcsuite/btcrpcclient(,费用可以通过使用
SetTxFee(fee btcutil.Amount) // hard coded0.0006 BTC
我将费用设置为 0.0000016 比特币/千字节,请执行以下操作:
- 列表未花费
- 设置交易费
- 创建原始交易
- 签名原始交易
- 发送原始交易
但是当我尝试发送交易时,我得到
-26: 256: absurdly-high-fee
有没有其他方法可以使用这个库设置费用?
调试.log
ThreadRPCServer method=listunspent
ThreadRPCServer method=settxfee
ThreadRPCServer method=createrawtransaction
ThreadRPCServer method=signrawtransaction
ThreadRPCServer method=sendrawtransaction
金额:
amounts := map[btcutil.Address]btcutil.Amount{
destAddress: destAmount,
}
更新似乎它试图发送交易的全部金额,而不是我希望它发送的金额。
如果 A 的交易是 1 BTC,而我想将 0.3 BTC 发送到另一个地址,那么在设置金额时如何实现这一点?
>settxfee
不适用于createrawtransaction
命令。
如果您有一个输入 1 BTC,您将发送 0.9 BTC,因此剩余金额是交易费用。
如果您不想为 0.1 BTC 设置交易费用,您可以发送 0.09 更改地址并留下 0.01,这是您的交易费用。