Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

feat(BUX-157): disabling of a dust limit validation for txs with OpReturn #353

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion model_draft_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func (m *DraftTransaction) createTransactionHex(ctx context.Context) (err error)
feePerByte := float64(m.Configuration.FeeUnit.Satoshis / m.Configuration.FeeUnit.Bytes)

reserveSatoshis := satoshisNeeded + m.estimateFee(m.Configuration.FeeUnit, 0)
if reserveSatoshis <= dustLimit {
if reserveSatoshis <= dustLimit && !m.containsOpReturn() {
m.client.Logger().Error(ctx, "amount of satoshis to send less than the dust limit")
return ErrOutputValueTooLow
}
Expand Down Expand Up @@ -904,3 +904,12 @@ func (m *DraftTransaction) SignInputs(xPriv *bip32.ExtendedKey) (signedHex strin
signedHex = txDraft.String()
return
}

func (m *DraftTransaction) containsOpReturn() bool {
for _, output := range m.Configuration.Outputs {
if output.OpReturn != nil {
return true
}
}
return false
}