Skip to content

Commit

Permalink
Update min relay fee calculation to match btcd calc
Browse files Browse the repository at this point in the history
Plucked from this btcd commit:
btcsuite/btcd@489ba8d

Would have been cherry-picked but changes with policy.go prevent that
for now
  • Loading branch information
alexlyp committed Apr 12, 2016
1 parent 2459171 commit 936b379
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions mempool.go
Expand Up @@ -710,16 +710,20 @@ func calcMinRequiredTxRelayFee(serializedSize int64,
// divide the transaction size by 1000 to convert to kilobytes. Also,
// integer division is used so fees only increase on full kilobyte
// boundaries.
var minTxRelayFee dcrutil.Amount
var minRelayTxFee dcrutil.Amount
switch {
case params == &chaincfg.MainNetParams:
minTxRelayFee = minTxRelayFeeMainNet
case params == &chaincfg.MainNetParams:
minTxRelayFee = minTxRelayFeeTestNet
minRelayTxFee = minTxRelayFeeMainNet
case params == &chaincfg.TestNetParams:
minRelayTxFee = minTxRelayFeeTestNet
default:
minTxRelayFee = minTxRelayFeeTestNet
minRelayTxFee = minTxRelayFeeTestNet
}
minFee := (serializedSize * int64(minRelayTxFee)) / 1000

if minFee == 0 && minRelayTxFee > 0 {
minFee = int64(minRelayTxFee)
}
minFee := (1 + serializedSize/1000) * int64(minTxRelayFee)

// Set the minimum fee to the maximum possible value if the calculated
// fee is not in the valid range for monetary amounts.
Expand Down

0 comments on commit 936b379

Please sign in to comment.