Skip to content
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

Allow hive to submit tx when not synced #7867

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Nethermind/Nethermind.Hive/HivePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public async Task InitNetworkProtocol()
if (_api.FileSystem is null) throw new ArgumentNullException(nameof(_api.FileSystem));
if (_api.BlockValidator is null) throw new ArgumentNullException(nameof(_api.BlockValidator));

_api.TxPool!.AcceptTxWhenNotSynced = true;

_api.TxGossipPolicy.Policies.Clear();

HiveRunner hiveRunner = new(
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Nethermind.TxPool/ITxPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ bool TryGetBlobAndProof(byte[] blobVersionedHash,
event EventHandler<TxEventArgs> NewPending;
event EventHandler<TxEventArgs> RemovedPending;
event EventHandler<TxEventArgs> EvictedPending;
public bool AcceptTxWhenNotSynced { get; set; }
}
}
1 change: 1 addition & 0 deletions src/Nethermind/Nethermind.TxPool/NullTxPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,6 @@ public event EventHandler<TxEventArgs>? EvictedPending
add { }
remove { }
}
public bool AcceptTxWhenNotSynced { get; set; }
}
}
4 changes: 3 additions & 1 deletion src/Nethermind/Nethermind.TxPool/TxPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,11 @@ public void RemovePeer(PublicKey nodeId)
}
}

public bool AcceptTxWhenNotSynced { get; set; }

public AcceptTxResult SubmitTx(Transaction tx, TxHandlingOptions handlingOptions)
{
if (_headInfo.IsSyncing) return AcceptTxResult.Syncing;
if (!AcceptTxWhenNotSynced && _headInfo.IsSyncing) return AcceptTxResult.Syncing;

Metrics.PendingTransactionsReceived++;

Expand Down
Loading