mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-07 14:46:44 +00:00
Ignore transaction invs on IBD (#1960)
* Ignore transaction invs on IBD * Add IsIBDRunning mock to TestHandleRelayedTransactionsNotFound Co-authored-by: Ori Newman <>
This commit is contained in:
parent
9f02a24e8b
commit
6449b03034
@ -22,6 +22,7 @@ type TransactionsRelayContext interface {
|
|||||||
SharedRequestedTransactions() *flowcontext.SharedRequestedTransactions
|
SharedRequestedTransactions() *flowcontext.SharedRequestedTransactions
|
||||||
OnTransactionAddedToMempool()
|
OnTransactionAddedToMempool()
|
||||||
EnqueueTransactionIDsForPropagation(transactionIDs []*externalapi.DomainTransactionID) error
|
EnqueueTransactionIDsForPropagation(transactionIDs []*externalapi.DomainTransactionID) error
|
||||||
|
IsIBDRunning() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type handleRelayedTransactionsFlow struct {
|
type handleRelayedTransactionsFlow struct {
|
||||||
@ -49,6 +50,10 @@ func (flow *handleRelayedTransactionsFlow) start() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if flow.IsIBDRunning() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
requestedIDs, err := flow.requestInvTransactions(inv)
|
requestedIDs, err := flow.requestInvTransactions(inv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -47,6 +47,10 @@ func (m *mocTransactionsRelayContext) EnqueueTransactionIDsForPropagation(transa
|
|||||||
func (m *mocTransactionsRelayContext) OnTransactionAddedToMempool() {
|
func (m *mocTransactionsRelayContext) OnTransactionAddedToMempool() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *mocTransactionsRelayContext) IsIBDRunning() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// TestHandleRelayedTransactionsNotFound tests the flow of HandleRelayedTransactions when the peer doesn't
|
// TestHandleRelayedTransactionsNotFound tests the flow of HandleRelayedTransactions when the peer doesn't
|
||||||
// have the requested transactions in the mempool.
|
// have the requested transactions in the mempool.
|
||||||
func TestHandleRelayedTransactionsNotFound(t *testing.T) {
|
func TestHandleRelayedTransactionsNotFound(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user