Skip to content

Conversation

@achow101
Copy link
Member

The GUI currently opts in to RBF by default, but RPCs do not, and -walletrbf is default disabled. This PR makes the default in those two places to also opt in.

The last time this was proposed (#9527), the primary objections were the novelty at the time, the inability to bump transactions, and the gui not having the option to disable rbf. In the 5 years since, RBF usage has steadily grown, with ~27% of txs opting in. The GUI has the option to enable/disable RBF, and is also defaulted to having it enabled. And we have the ability to bump RBF'd transactions in both the RPC and the GUI. So I think it makes sense to finally change the default to always opt in to RBF.

@ariard
Copy link

ariard commented Jul 14, 2022

Concept ACK

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 14, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25344 (New outputs argument for bumpfee/psbtbumpfee by rodentrabies)
  • #21283 (Implement BIP 370 PSBTv2 by achow101)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Comment on lines +307 to 310
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::optional<bool> rbf;
if (!request.params[3].isNull()) {
rbf = request.params[3].isTrue();
}
const bool rbf{request.params[3].isNull() ? true : request.params[3].getBool()};

Seems complicated to use optional<bool> when it is not needed?

Copy link
Member Author

@achow101 achow101 Jul 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of the optional was done to allow for the current behavior with user defined sequence numbers to work. There is a check in ConstructTransaction that the sequence numbers match the replaceable option. It will throw an error if non-RBF sequences are used, but replaceable is true. Additionally, if replacable is either not specified or false (which is the same thing currently), setting a RBF sequence does not result in an error. If the default is just changed to true, then this check fails when the user sets non-RBF sequence numbers and does not specify replaceable at all. By using an optional we can retain the behavior that sequences are not checked against replaceable when replaceable is not specified.

@maflcko
Copy link
Member

maflcko commented Jul 14, 2022

I've closed #25602, so Concept ACK on this change to take over.

@glozow
Copy link
Member

glozow commented Jul 14, 2022

concept ACK

@darosior
Copy link
Member

Concept ACK

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

Should these changes of defaults be mentioned in the release notes?

@maflcko maflcko added this to the 24.0 milestone Jul 14, 2022
@instagibbs
Copy link
Member

concept ACK

@Sjors
Copy link
Member

Sjors commented Jul 14, 2022

No strong feelings.

Needs a clear release note, because there may still be systems that rely on RBF being off by default. Could also document that the two ways to work around the change are to set walletrbf=0 or to set the RBF parameter in the RPC call. The latter may seem like the most obvious solution, but sometimes software depends on dependencies of dependencies to actually call the RPC. (And those don't always let you pass every parameter)

@maflcko
Copy link
Member

maflcko commented Jul 14, 2022

Maybe there could be a global -rpcrawtransactionsrbf option to address your concern for raw transactions?

@achow101
Copy link
Member Author

Added some release notes.

Copy link
Member

@darosior darosior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 6b59d754644a5eda6ff8b4378de5320f31cc8111

Happy to reACK if you take Marco's nit.

@achow101 achow101 force-pushed the walletrbf-default-on branch from 6b59d75 to ab3c06d Compare July 15, 2022 15:56
@darosior
Copy link
Member

darosior commented Jul 16, 2022

reACK ab3c06d

Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.

I find it strange that the RPCs don't default to the -walletrbf setting. Was there a reason for that?

@achow101
Copy link
Member Author

I find it strange that the RPCs don't default to the -walletrbf setting. Was there a reason for that?

createrawtransaction and createpsbt are non-wallet RPCs and so need to work without a wallet. The wallet RPCs already follow the -walletrbf setting.

Copy link
Contributor

@aureleoules aureleoules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ab3c06d.

I verified that the rpc wallet option replaceable is enabled by default and the wallet RBF feature is enabled by default as well.

Would it make sense to remove -walletrbf=1 in the test below, to make use of this change?

["-walletrbf=1", "-addresstype=bech32", "-changetype=bech32"], #TODO: Remove address type restrictions once taproot has psbt extensions

Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK ab3c06d

+1 to this comment in e3c3363:

Would it make sense to remove -walletrbf=1 in the test below, to make use of this change?

and I think -walletrbf=1 can be removed for wallet_send.py as well

}

if (rbf && rawTx.vin.size() > 0 && !SignalsOptInRBF(CTransaction(rawTx))) {
if (rbf.has_value() && rbf.value() && rawTx.vin.size() > 0 && !SignalsOptInRBF(CTransaction(rawTx))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understanding this as: ConstructTransaction uses rbf to both determine sequence numbers and enforce signaling on the resulting transaction, and since default rbf is true, it will require rbf on every transaction by default, even if the inputs were entirely specified by the user. We don't want to force users to now specify rbf=false if they want to manually construct a transaction that doesn't signal rbf. So this is why we change it to a tristate to represent "tx should signal rbf" vs "rbf signal doesn't matter."

@glozow glozow requested a review from murchandamus July 18, 2022 11:22
@maflcko
Copy link
Member

maflcko commented Jul 18, 2022

Would it make sense to remove -walletrbf=1 in the test below, to make use of this change?

One could argue that tests should document what settings they rely on, even if the value they rely on is the default value, so it could also be left as-is, but I don't have a strong opinion.

@maflcko maflcko merged commit c5ba1d9 into bitcoin:master Aug 1, 2022
@murchandamus
Copy link
Contributor

Post-merge ACK

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 1, 2022
@bitcoin bitcoin locked and limited conversation to collaborators Aug 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.