-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix claim #34
Merged
Merged
Fix claim #34
Changes from 10 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b842377
Fix for ClaimTransactions
shargon 0b5f43b
Fix
shargon 8857805
Revert
shargon e239034
Update Settings.cs
shargon ca61f30
Update Settings.cs
shargon 8a6cf3c
Update Settings.cs
shargon 4e08c82
Clean
shargon 15ef420
Fix
shargon 35bd5fd
Fix
shargon 8ac301d
Clean
shargon 61ea758
testing claim transactions
igormcoelho 7467106
claim working in tests
igormcoelho b8e9b74
revert project file
igormcoelho ba6b2d9
Clean code
shargon 1db049a
add `EnumSet<T>`
erikzhang fbea9d6
Update Settings.cs
erikzhang 84cc0b8
Fix sorting algorithm
erikzhang 417c7d7
fix tests
erikzhang 87edf28
fixed ordering with priority first
igormcoelho 837c4b9
reverted ordering and improved testing
igormcoelho 1951a46
Fix compilation errors
erikzhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ private static IEnumerable<Transaction> FilterForBlock_Policy1(IEnumerable<Trans | |
foreach (Transaction tx in transactions.OrderByDescending(p => p.NetworkFee / p.Size).ThenByDescending(p => p.NetworkFee)) | ||
{ | ||
if (count++ >= Settings.Default.MaxTransactionsPerBlock - 1) break; | ||
if (!tx.IsLowPriority || count_free++ < Settings.Default.MaxFreeTransactionsPerBlock) | ||
if (!IsLowPriority(tx) || count_free++ < Settings.Default.MaxFreeTransactionsPerBlock) | ||
yield return tx; | ||
} | ||
} | ||
|
@@ -60,13 +60,13 @@ private static IEnumerable<Transaction> FilterForBlock_Policy2(IEnumerable<Trans | |
if (!(transactions is IReadOnlyList<Transaction> tx_list)) | ||
tx_list = transactions.ToArray(); | ||
|
||
Transaction[] free = tx_list.Where(p => p.IsLowPriority) | ||
Transaction[] free = tx_list.Where(p => IsLowPriority(p)) | ||
.OrderByDescending(p => p.NetworkFee / p.Size) | ||
.ThenByDescending(p => p.NetworkFee) | ||
.Take(Settings.Default.MaxFreeTransactionsPerBlock) | ||
.ToArray(); | ||
|
||
Transaction[] non_free = tx_list.Where(p => !p.IsLowPriority) | ||
Transaction[] non_free = tx_list.Where(p => !IsLowPriority(p)) | ||
.OrderByDescending(p => p.NetworkFee / p.Size) | ||
.ThenByDescending(p => p.NetworkFee) | ||
.Take(Settings.Default.MaxTransactionsPerBlock - free.Length - 1) | ||
|
@@ -93,7 +93,7 @@ void ILogPlugin.Log(string source, LogLevel level, string message) | |
private bool VerifySizeLimits(Transaction tx) | ||
{ | ||
// Not Allow free TX bigger than MaxFreeTransactionSize | ||
if (tx.IsLowPriority && tx.Size > Settings.Default.MaxFreeTransactionSize) return false; | ||
if (IsLowPriority(tx) && tx.Size > Settings.Default.MaxFreeTransactionSize) return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok ClaimTx wont enter here, because its not LowPriority, right? So its not limited to MaxFreeTransactionSize right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be able to enable and disable this in the config, but yes |
||
|
||
// Require proportional fee for TX bigger than MaxFreeTransactionSize | ||
if (tx.Size > Settings.Default.MaxFreeTransactionSize) | ||
|
@@ -104,5 +104,12 @@ private bool VerifySizeLimits(Transaction tx) | |
} | ||
return true; | ||
} | ||
|
||
private static bool IsLowPriority(Transaction tx) | ||
{ | ||
if (Settings.Default.HighPriorityTxType.Contains(tx.Type)) return false; | ||
|
||
return tx.IsLowPriority; | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, ClaimTx will enter here because its not LowPriority, correct? This is the part Im trying to.test (but will only be able to finish tomorrow). If ClaimTx netfee is always zero, wouldnt it be sent forever to the end of the queue?
I guess Peter mentioned this situation... so if thats the case, we will need to insert it together with the free tx (20 maximum), with bigger priority than all other free tx, and not subject to maxfreetxsizelimit. Please confirm if Im mistaken here.