Skip to content

Commit 41f705c

Browse files
committed
Backend/Bitcoin: enabled RBF in all outgoing transactions
It's arguable if this will be enabled by default on upstream NBitcoin (my PR is being debated[1]) so I'll enable it from GWallet in the meantime. [1] MetacoSA/NBitcoin#355
1 parent 6a14b30 commit 41f705c

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

ReadMe.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ GWallet is a minimalistic and pragmatist lightweight wallet for people that want
77
| Branch | Description | CI status |
88
| -------- | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
99
| stable | ETC & ETH support, console-based frontend, cold-storage support | [![Build status badge](http://gitlab.com/knocte/gwallet/badges/stable/build.svg)](https://gitlab.com/knocte/gwallet/commits/stable) |
10-
| master | +BTC support (SegWit by default); soon: LTC | [![Build status badge](http://gitlab.com/knocte/gwallet/badges/master/build.svg)](https://gitlab.com/knocte/gwallet/commits/master) |
10+
| master | +BTC support (SegWit & RBF support); soon: LTC | [![Build status badge](http://gitlab.com/knocte/gwallet/badges/master/build.svg)](https://gitlab.com/knocte/gwallet/commits/master) |
1111
| frontend | +Xamarin.Forms frontends in progress (now: Android, iOS; soon: gtk, UWP) | [![Build status badge](http://gitlab.com/knocte/gwallet/badges/frontend/build.svg)](https://gitlab.com/knocte/gwallet/commits/frontend) |
1212

1313

@@ -25,7 +25,6 @@ GWallet will always be standing in the shoulders of giants, which means we have
2525
This list is the (intended) order of preference for new features:
2626

2727
- Xamarin.Forms frontends (in progress, see the 'frontend' branch)...
28-
- RBF support.
2928
- LTC support.
3029
- Fee selection for custom priority.
3130
- Multi-sig support.

src/GWallet.Backend/Bitcoin/BitcoinAccount.fs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ module internal Account =
9494
seq {
9595
for input in transactionDraft.Inputs do
9696
let inputTx = Transaction(input.RawTransaction)
97-
transaction.AddInput(inputTx, input.OutputIndex) |> ignore
97+
let inputAdded = transaction.AddInput(inputTx, input.OutputIndex)
98+
99+
// mark RBF=enabled by default
100+
inputAdded.Sequence <- Sequence(0)
101+
if not inputAdded.Sequence.IsRBF then
102+
failwith "input should have been marked as RBF by default"
103+
98104
yield Coin(inputTx, uint32 input.OutputIndex)
99105
} |> List.ofSeq
100106

@@ -103,6 +109,12 @@ module internal Account =
103109
let txOut = TxOut(Money(output.ValueInSatoshis), destAddress)
104110
transaction.Outputs.Add(txOut)
105111

112+
if not transaction.RBF then
113+
failwith "transaction should have been marked as RBF by default"
114+
if transaction.LockTime.IsTimeLock then
115+
failwith "transaction shouldn't be marked as time lock"
116+
if transaction.LockTime.Height <> 0 then
117+
failwith "transaction height shouldn't be different than 0"
106118
transaction,coins
107119

108120
type internal UnspentTransactionOutputInfo =

0 commit comments

Comments
 (0)