-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting RBF dynamic cost is invalid #158
Comments
Set the number of the sequence field to 4294967295, and when pulling up the xverse, the free fee cannot be dynamically adjusted |
Hi @mlymq0080 I just want to confirm the issue. Is the scenario:
If this is the issue, this is expected behavior. If the transaction was created externally and just sent to Xverse for signing, then we assume that the transaction is what needs to be signed and is not mutable. In order to make the fees changeable, we would need to edit the outputs of the PSBT and, possibly, add an input, which would result in a completely new transaction. If you'd like the user to set a fee rate on the transaction, you need to allow them to set it on your site and calculate the fee when building the transaction before sending it to the wallet for signing. |
HI @victorkirov I still don't understand what you mean. Do I need to input another unused UTXO into the output in order to make the transaction cost variable? Can you write a simple example. |
async sign(addresses,unspentOutputs,fastestFee){ const createPsbt = (addresses,unspentOutputs,fastestFee) => { const tx = new btc.Transaction({ const bitcoinTestnet = { const output = unspentOutputs const publicKey = hex.decode(addresses[0].publicKey) tx.addInput({ const changeAddress = addresses[0].address tx.addOutputAddress(this.recipient, BigInt(1000), bitcoinTestnet) const sizes = tx.inputsLength * 148 + (tx.outputsLength +1) * 44 + 10 tx.addOutputAddress(changeAddress, BigInt(zhamount), bitcoinTestnet) const psbt = tx.toPSBT(0) await signTransaction({
},
}, |
When signing a PSBT, the wallet doesn't edit the transaction sent by the dapp. It just parses it and displays it for confirmation and signing. In order to edit fees, we would need to change the values of the outputs, which would change the underlying PSBT, so we don't do it. This means that the desired fee would need to be taken into account by the dapp that builds the PSBT before it is sent to the wallet for signing. |
Setting the sequence to a value which enables RBF for an input doesn't change how we handle the transaction. It will only allow the transaction to be replaced via RBF with one with a higher fee once it is published. |
How it is possible then to increase the fees of a PSBT tx, in case eg. it is stuck? |
Is there an existing issue for this?
SATS-CONNECT Version
2.5.x
Current Behavior
设置 sequence 这个字段数字为4294967295,xverse里面拉起来的时候确不能动态调整free费
Expected Behavior
No response
Steps To Reproduce
//使用包装隔离验证 (P2SH-P2WPHK) 地址创建交易 SegWit 标志
// addresses[1].publicKey 就是 payment publicKey,在获取地址时拿到
const publicKey = hex.decode(addresses[0].publicKey)
const p2wpkh = btc.p2wpkh(publicKey, bitcoinTestnet)
const p2sh = btc.p2sh(p2wpkh, bitcoinTestnet)
tx.addInput({
txid: output.txid,
index: output.vout,
sequence: btc.DEFAULT_SEQUENCE, //RBF标志 目前设置了没有效果
witnessUtxo: {
script: p2sh.script,
amount: BigInt(output.value)
},
redeemScript: p2sh.redeemScript
})
Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: