Send orphan hash in notifications instead of root.

Rather than sending the root of the an orphan chain when sending an orphan
notification, send the hash of the orphan block itself.  The caller can
then call the GetOrphanRoot function with the hash to get the root of the
orphan chain as needed.  This is being changed since it's cleaner and more
detministic sending the hash for the orphan block that was just processed
rather than sending a possibly different hash depending on whether there
is an orphan chain or not.
This commit is contained in:
Dave Collins 2013-09-09 19:35:36 -05:00
parent 0ba8cb9187
commit b557a33f7c
2 changed files with 5 additions and 7 deletions

View file

@ -14,8 +14,9 @@ type NotificationType int
// Constants for the type of a notification message. // Constants for the type of a notification message.
const ( const (
// NTOrphanBlock indicates an orphan block was processed and the // NTOrphanBlock indicates an orphan block was processed and the
// associated block hash is the root of all known orphans which should // associated block hash should be passed to the GetOrphanRoot function
// be used to request the missing blocks. // to find the root of all known orphans which should then be used to
// request the missing blocks.
NTOrphanBlock NotificationType = iota NTOrphanBlock NotificationType = iota
// NTBlockAccepted indicates the associated block was accepted into // NTBlockAccepted indicates the associated block was accepted into

View file

@ -148,11 +148,8 @@ func (b *BlockChain) ProcessBlock(block *btcutil.Block) error {
prevHash) prevHash)
b.addOrphanBlock(block) b.addOrphanBlock(block)
// Get the hash for the head of the orphaned block chain for // Notify the caller so it can request missing blocks.
// this block and notify the caller so it can request missing b.sendNotification(NTOrphanBlock, blockHash)
// blocks.
orphanRoot := b.GetOrphanRoot(blockHash)
b.sendNotification(NTOrphanBlock, orphanRoot)
return nil return nil
} }