Merge pull request #1625 from yyforyongyu/fix-notfound-message
btcd+netsync: support witness tx and block in notfound msg
This commit is contained in:
commit
9ef973c282
2 changed files with 9 additions and 0 deletions
|
@ -1031,11 +1031,16 @@ func (sm *SyncManager) handleNotFoundMsg(nfmsg *notFoundMsg) {
|
||||||
// verify the hash was actually announced by the peer
|
// verify the hash was actually announced by the peer
|
||||||
// before deleting from the global requested maps.
|
// before deleting from the global requested maps.
|
||||||
switch inv.Type {
|
switch inv.Type {
|
||||||
|
case wire.InvTypeWitnessBlock:
|
||||||
|
fallthrough
|
||||||
case wire.InvTypeBlock:
|
case wire.InvTypeBlock:
|
||||||
if _, exists := state.requestedBlocks[inv.Hash]; exists {
|
if _, exists := state.requestedBlocks[inv.Hash]; exists {
|
||||||
delete(state.requestedBlocks, inv.Hash)
|
delete(state.requestedBlocks, inv.Hash)
|
||||||
delete(sm.requestedBlocks, inv.Hash)
|
delete(sm.requestedBlocks, inv.Hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case wire.InvTypeWitnessTx:
|
||||||
|
fallthrough
|
||||||
case wire.InvTypeTx:
|
case wire.InvTypeTx:
|
||||||
if _, exists := state.requestedTxns[inv.Hash]; exists {
|
if _, exists := state.requestedTxns[inv.Hash]; exists {
|
||||||
delete(state.requestedTxns, inv.Hash)
|
delete(state.requestedTxns, inv.Hash)
|
||||||
|
|
|
@ -1321,8 +1321,12 @@ func (sp *serverPeer) OnNotFound(p *peer.Peer, msg *wire.MsgNotFound) {
|
||||||
switch inv.Type {
|
switch inv.Type {
|
||||||
case wire.InvTypeBlock:
|
case wire.InvTypeBlock:
|
||||||
numBlocks++
|
numBlocks++
|
||||||
|
case wire.InvTypeWitnessBlock:
|
||||||
|
numBlocks++
|
||||||
case wire.InvTypeTx:
|
case wire.InvTypeTx:
|
||||||
numTxns++
|
numTxns++
|
||||||
|
case wire.InvTypeWitnessTx:
|
||||||
|
numTxns++
|
||||||
default:
|
default:
|
||||||
peerLog.Debugf("Invalid inv type '%d' in notfound message from %s",
|
peerLog.Debugf("Invalid inv type '%d' in notfound message from %s",
|
||||||
inv.Type, sp)
|
inv.Type, sp)
|
||||||
|
|
Loading…
Reference in a new issue