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

Commit

Permalink
Merge pull request #353 from vitalibalashka/feat/dust_limit_opreturn
Browse files Browse the repository at this point in the history
feat(BUX-157): disabling of a dust limit validation for txs with OpReturn
  • Loading branch information
mergify[bot] authored Aug 7, 2023
2 parents b7213a1 + f2ad897 commit c398c2a
Showing 1 changed file with 10 additions and 1 deletion.
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
}

0 comments on commit c398c2a

Please sign in to comment.