Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Bug fix add txs to peer priority txs #184

Merged
merged 2 commits into from
Sep 24, 2020

Conversation

jinmannwong
Copy link
Contributor

@jinmannwong jinmannwong commented Sep 24, 2020

Bug fix to allow appending of dkg txs to peerPointer. Removed filtering of priority txs in GetNewTxs when getting transactions from main txs queue.

// Priority txs are gossiped using peer pointer priority txs so we to do not include
// them here to avoid sending duplicates
if _, ok := memTx.senders.Load(peerID); !ok && !isPriority(memTx.tx) {
if _, ok := memTx.senders.Load(peerID); !ok {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed check for isPriority as sometimes a peer does not yet exist when DKG txs are added to mempool. Removing this check allows these txs to be included from the main mempool queue. Since DKG transactions are appended in the front of the queue there will not be many duplicates in the gossip beyond the first few transactions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Is this just fixing the corner case when the network starts for the first time?

_, err := rand.Read(txBytes)
if err != nil {
t.Error(err)
}
txBytes = tx_extensions.PrependBytes(txBytes) // Convert to priority tx (dkg)
assert.True(t, isPriority(txBytes))
txs[i] = txBytes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having rand after the prepend was messing up prefix and made the tx no longer a priority tx

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// Priority txs are gossiped using peer pointer priority txs so we to do not include
// them here to avoid sending duplicates
if _, ok := memTx.senders.Load(peerID); !ok && !isPriority(memTx.tx) {
if _, ok := memTx.senders.Load(peerID); !ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Is this just fixing the corner case when the network starts for the first time?

_, err := rand.Read(txBytes)
if err != nil {
t.Error(err)
}
txBytes = tx_extensions.PrependBytes(txBytes) // Convert to priority tx (dkg)
assert.True(t, isPriority(txBytes))
txs[i] = txBytes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jinmannwong jinmannwong merged commit 1bb94da into fetchai:master Sep 24, 2020
@jinmannwong jinmannwong deleted the bug_fix/dkg_gossip branch September 24, 2020 10:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants