mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
RBF on by default, can disable it in Wallet Send /advanced settings.
This commit is contained in:
parent
3a05f7e294
commit
d7fc079376
8 changed files with 28 additions and 5 deletions
|
@ -64,6 +64,7 @@ namespace BTCPayServer
|
|||
public KeyPath CoinType { get; internal set; }
|
||||
public int MaxTrackedConfirmation { get; internal set; } = 6;
|
||||
public string[] DefaultRateRules { get; internal set; } = Array.Empty<string>();
|
||||
public bool SupportRBF { get; internal set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
|
|
@ -25,7 +25,8 @@ namespace BTCPayServer
|
|||
CryptoImagePath = "imlegacy/bitcoin.svg",
|
||||
LightningImagePath = "imlegacy/bitcoin-lightning.svg",
|
||||
DefaultSettings = BTCPayDefaultSettings.GetDefaultSettings(NetworkType),
|
||||
CoinType = NetworkType == NetworkType.Mainnet ? new KeyPath("0'") : new KeyPath("1'")
|
||||
CoinType = NetworkType == NetworkType.Mainnet ? new KeyPath("0'") : new KeyPath("1'"),
|
||||
SupportRBF = true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ namespace BTCPayServer.Controllers
|
|||
model.CurrentBalance = (await balance).ToDecimal(MoneyUnit.BTC);
|
||||
model.RecommendedSatoshiPerByte = (int)(await recommendedFees).GetFee(1).Satoshi;
|
||||
model.FeeSatoshiPerByte = model.RecommendedSatoshiPerByte;
|
||||
|
||||
model.SupportRBF = network.SupportRBF;
|
||||
using (CancellationTokenSource cts = new CancellationTokenSource())
|
||||
{
|
||||
try
|
||||
|
@ -212,7 +212,7 @@ namespace BTCPayServer.Controllers
|
|||
var network = this.NetworkProvider.GetNetwork(walletId?.CryptoCode);
|
||||
if (network == null)
|
||||
return NotFound();
|
||||
|
||||
vm.SupportRBF = network.SupportRBF;
|
||||
var destination = ParseDestination(vm.Destination, network.NBitcoinNetwork);
|
||||
if (destination == null)
|
||||
ModelState.AddModelError(nameof(vm.Destination), "Invalid address");
|
||||
|
@ -233,7 +233,8 @@ namespace BTCPayServer.Controllers
|
|||
Amount = vm.Amount.Value,
|
||||
SubstractFees = vm.SubstractFees,
|
||||
FeeSatoshiPerByte = vm.FeeSatoshiPerByte,
|
||||
NoChange = vm.NoChange
|
||||
NoChange = vm.NoChange,
|
||||
DisableRBF = vm.DisableRBF
|
||||
};
|
||||
if (command == "ledger")
|
||||
{
|
||||
|
@ -254,6 +255,10 @@ namespace BTCPayServer.Controllers
|
|||
CreatePSBTRequest psbtRequest = new CreatePSBTRequest();
|
||||
CreatePSBTDestination psbtDestination = new CreatePSBTDestination();
|
||||
psbtRequest.Destinations.Add(psbtDestination);
|
||||
if (network.SupportRBF)
|
||||
{
|
||||
psbtRequest.RBF = !sendModel.DisableRBF;
|
||||
}
|
||||
psbtDestination.Destination = BitcoinAddress.Create(sendModel.Destination, network.NBitcoinNetwork);
|
||||
psbtDestination.Amount = Money.Coins(sendModel.Amount);
|
||||
psbtRequest.FeePreference = new FeePreference();
|
||||
|
@ -447,7 +452,7 @@ namespace BTCPayServer.Controllers
|
|||
int account = 0,
|
||||
// sendtoaddress
|
||||
bool noChange = false,
|
||||
string destination = null, string amount = null, string feeRate = null, bool substractFees = false
|
||||
string destination = null, string amount = null, string feeRate = null, bool substractFees = false, bool disableRBF = false
|
||||
)
|
||||
{
|
||||
if (!HttpContext.WebSockets.IsWebSocketRequest)
|
||||
|
@ -511,6 +516,7 @@ namespace BTCPayServer.Controllers
|
|||
|
||||
model.SubstractFees = substractFees;
|
||||
model.NoChange = noChange;
|
||||
model.DisableRBF = disableRBF;
|
||||
if (command == "test")
|
||||
{
|
||||
result = await hw.Test(normalOperationTimeout.Token);
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace BTCPayServer.Models.WalletViewModels
|
|||
{
|
||||
public int FeeSatoshiPerByte { get; set; }
|
||||
public bool SubstractFees { get; set; }
|
||||
public bool DisableRBF { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public string Destination { get; set; }
|
||||
public bool NoChange { get; set; }
|
||||
|
|
|
@ -35,5 +35,8 @@ namespace BTCPayServer.Models.WalletViewModels
|
|||
public int Divisibility { get; set; }
|
||||
public string Fiat { get; set; }
|
||||
public string RateError { get; set; }
|
||||
public bool SupportRBF { get; set; }
|
||||
[Display(Name = "Disable RBF")]
|
||||
public bool DisableRBF { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,6 +71,14 @@
|
|||
<a href="https://docs.btcpayserver.org/features/wallet#make-sure-no-change-utxo-is-created-expert-mode" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
<input asp-for="NoChange" class="form-check" />
|
||||
</div>
|
||||
@if (Model.SupportRBF)
|
||||
{
|
||||
<div class="form-group">
|
||||
<label asp-for="DisableRBF"></label>
|
||||
<a href="https://bitcoin.org/en/glossary/rbf" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
<input asp-for="DisableRBF" class="form-check" />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<input type="hidden" asp-for="Destination" />
|
||||
<input type="hidden" asp-for="Amount" />
|
||||
<input type="hidden" asp-for="FeeSatoshiPerByte" />
|
||||
<input type="hidden" asp-for="DisableRBF" />
|
||||
<input type="hidden" asp-for="SubstractFees" />
|
||||
<input type="hidden" asp-for="NoChange" />
|
||||
<p>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
var fee = $("#FeeSatoshiPerByte").val();
|
||||
var substractFee = $("#SubstractFees").val();
|
||||
var noChange = $("#NoChange").val();
|
||||
var disableRBF = $("#DisableRBF").val();
|
||||
|
||||
var loc = window.location, ws_uri;
|
||||
if (loc.protocol === "https:") {
|
||||
|
@ -48,6 +49,7 @@
|
|||
args += "&feeRate=" + fee;
|
||||
args += "&substractFees=" + substractFee;
|
||||
args += "&noChange=" + noChange;
|
||||
args += "&disableRBF=" + disableRBF;
|
||||
|
||||
if (noChange === "True") {
|
||||
WriteAlert("warning", 'WARNING: Because you want to make sure no change UTXO is created, you will end up sending more than the chosen amount to your destination. Please validate the transaction on your ledger');
|
||||
|
|
Loading…
Add table
Reference in a new issue