Skip to content

Commit

Permalink
Use new enableRbf field on EdgeSpendInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
samholmes committed Jun 7, 2024
1 parent 3a2cfec commit 66f07e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- changed: Use new `enableRbf` field on `EdgeSpendInfo` instead of unofficial field in `otherParams`

## 3.0.2 (2024-06-03)

- fixed: Check transaction input sequence values for RBF transaction acceleration.
Expand Down
12 changes: 8 additions & 4 deletions src/common/utxobased/engine/UtxoEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,13 @@ export async function makeUtxoEngine(
targets = []
}

// Determine whether the transaction should enable RBF given that the
// currency supports RBF.
const enableRbf =
currencyInfo.canReplaceByFee === true
? edgeSpendInfo.enableRbf ?? true
: false

log.warn(`spend: Using fee rate ${feeRate} sat/B`)
const subtractFee =
txOptions.subtractFee != null ? txOptions.subtractFee : false
Expand All @@ -628,10 +635,7 @@ export async function makeUtxoEngine(
feeRate,
coin: coinInfo.name,
currencyCode: currencyInfo.currencyCode,
enableRbf:
spendInfoOtherParams.enableRbf ??
currencyInfo.canReplaceByFee ??
false,
enableRbf,
freshChangeAddress,
subtractFee,
log,
Expand Down
1 change: 0 additions & 1 deletion src/common/utxobased/engine/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export type UtxoSpendInfoOtherParams = ReturnType<
typeof asUtxoSpendInfoOtherParams
>
export const asUtxoSpendInfoOtherParams = asObject({
enableRbf: asOptional(asBoolean),
forceChangeAddress: asOptional(asString),
outputSort: asOptional(asOutputSort, 'bip69'),
txOptions: asOptional(asTxOptions),
Expand Down

0 comments on commit 66f07e0

Please sign in to comment.