-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Payloads: implement Conflicts attribute #2818
Conversation
30c6461
to
7d75211
Compare
@shargon @AnnaShaleva This pr is in 3.6 list, may you please update and review it. |
src/Neo/Ledger/MemoryPool.cs
Outdated
var persisted = block.Transactions.Select(t => t.Hash); | ||
var stale = new List<UInt256>(); | ||
foreach (var item in _sortedTransactions) | ||
{ | ||
if (conflicts.Contains(item.Tx.Hash) || item.Tx.GetAttributes<Conflicts>().Select(a => a.Hash).Intersect(persisted).Count() > 0) | ||
{ | ||
stale.Add(item.Tx.Hash); | ||
conflictingItems.Add(item.Tx); | ||
} | ||
} | ||
foreach (var h in stale) | ||
{ | ||
if (!TryRemoveVerified(h, out _)) TryRemoveUnVerified(h, out _); | ||
} |
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.
IIRC LINQ is somewhat slower, but I'm OK either way. @shargon?
Fix the comment neo-project#2818 (comment).
Fix the comment neo-project#2818 (comment).
Rebased onto current master, ready for review. |
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.
I am reviewing again, can you clarify the trimmed
a little bit more to me?
Fix Vitor's comments.
Sure. Consider the situation when transaction |
@shargon, take a look at the latest commit, please. Turns out I've accidentally missed this patch when I was fixing our #2818 (comment) conversation. This patch should be a part of fd1748d commit actually (and I did all the things right in NeoGo in nspcc-dev/neo-go@ee4b8f8#diff-aec93d55c952fa59b011c31e50ccae3fb3303260537d58df6a70309bb94af622R551-R560). |
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@shargon, take a look at the test, please: b6856ff. I've adjusted it, the idea is to persist conflicting
BTW, this scenario was tested by @superboyiii, IINM, it was passed OK. And we have a set of tests in NeoGo testing that on-chain conflicts work as expected, see the tests added in nspcc-dev/neo-go@ee4b8f8#diff-aec93d55c952fa59b011c31e50ccae3fb3303260537d58df6a70309bb94af622R551-R560. |
Check out for adding gas lines 46 to 51
|
Move it to the UT_Blockchain.cs file and refactor it a bit to make it actually pass as expected. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@shargon, I've managed to fix the |
If this PR can't be merged before 4th Sep, we will release v3.6.0 directly. Too much time for waiting. We can add this to v3.7.0. |
It’s ready for review, all issues are fixed. |
Co-authored-by: Shargon <shargon@gmail.com>
Fix neo-project#2818 (comment). Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@shargon Need your merge. |
No change need to make and need to perpare for merge
* DBFTPlugin: adapt Conflicts attribute verification Depends on neo-project/neo#2818, see the neo-project/neo#2818 (comment). Signed-off-by: Anna Shaleva <anna@nspcc.ru> * Fix Conflicts attribute verification Fetch the update from core: neo-project/neo#2818 (comment). * Fetch on-chain conflict signer fix from core Use new API from neo-project/neo@ee7333f. --------- Signed-off-by: Anna Shaleva <anna@nspcc.ru> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: Jimmy <jinghui@wayne.edu>
Closes #1991. Partially based on #2661, but verification-related logic is refactored to match the initial behaviour design.
Depends on #2812.