Skip to content

Commit

Permalink
check 4
Browse files Browse the repository at this point in the history
  • Loading branch information
OsauravO committed Apr 27, 2024
1 parent 2241a28 commit 0837c57
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,15 @@ func Ordering() (uint64, []string, []string) {
var reward uint64 = 0
var allowedTxs []TxInfo
var maxWeight uint64 = 4000000
var targetRatio float64 = 0.99
var targetScore float64 = 108.0

for _, tx := range txInfo {
if maxWeight >= tx.Weight && float64(reward+tx.Fee)/float64(maxWeight) <= targetRatio {
remainingWeight := maxWeight - tx.Weight
currentScore := float64(reward+tx.Fee) / float64(maxWeight-remainingWeight) * 100.0

if remainingWeight >= 0 && currentScore <= targetScore {
allowedTxs = append(allowedTxs, tx)
maxWeight -= tx.Weight
maxWeight = remainingWeight
allowedTxIDs = append(allowedTxIDs, tx.TxID)
notAllowedTxIDs = append(notAllowedTxIDs, tx.WTxID)
reward += tx.Fee
Expand Down

0 comments on commit 0837c57

Please sign in to comment.