mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-09 07:36:43 +00:00
[NOD-489] Don't skip notification about transactions for orphan/non-current blocks (#511)
This commit is contained in:
parent
9cc2a7260b
commit
e68b242243
@ -7,12 +7,13 @@ package netsync
|
|||||||
import (
|
import (
|
||||||
"container/list"
|
"container/list"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/daglabs/btcd/blockdag"
|
"github.com/daglabs/btcd/blockdag"
|
||||||
"github.com/daglabs/btcd/dagconfig"
|
"github.com/daglabs/btcd/dagconfig"
|
||||||
"github.com/daglabs/btcd/database"
|
"github.com/daglabs/btcd/database"
|
||||||
@ -1290,15 +1291,12 @@ func (sm *SyncManager) handleBlockDAGNotification(notification *blockdag.Notific
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Don't relay if we are not current or the block was just now unorphaned.
|
// Relay if we are current and the block was not just now unorphaned.
|
||||||
// Other peers that are current should already know about it
|
// Otherwise peers that are current should already know about it
|
||||||
if !sm.current() || data.WasUnorphaned {
|
if sm.current() && !data.WasUnorphaned {
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the inventory vector and relay it.
|
|
||||||
iv := wire.NewInvVect(wire.InvTypeBlock, block.Hash())
|
iv := wire.NewInvVect(wire.InvTypeBlock, block.Hash())
|
||||||
sm.peerNotifier.RelayInventory(iv, block.MsgBlock().Header)
|
sm.peerNotifier.RelayInventory(iv, block.MsgBlock().Header)
|
||||||
|
}
|
||||||
|
|
||||||
for msg := range ch {
|
for msg := range ch {
|
||||||
sm.peerNotifier.TransactionConfirmed(msg.Tx)
|
sm.peerNotifier.TransactionConfirmed(msg.Tx)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user