Minor cleanup.

Fix a couple of comments and call tx.Sha directly in a couple of places.
This commit is contained in:
Dave Collins 2013-10-30 14:13:29 -05:00
parent b866e9f14c
commit 70094fcee8
2 changed files with 5 additions and 5 deletions

View file

@ -271,7 +271,7 @@ func (b *blockManager) handleTxMsg(tmsg *txMsg) {
// Keep track of which peer the tx was sent from.
txHash := tmsg.tx.Sha()
// If we didn't ask for this block then the peer is misbehaving.
// If we didn't ask for this transaction then the peer is misbehaving.
if _, ok := tmsg.peer.requestedTxns[*txHash]; !ok {
log.Warnf("BMGR: Got unrequested transaction %v from %s -- "+
"disconnecting", txHash, tmsg.peer.addr)

View file

@ -616,7 +616,8 @@ func (mp *txMemPool) maybeAcceptTransaction(tx *btcutil.Tx, isOrphan *bool) erro
}
// Get the current height of the main chain. A standalone transaction
// will be mined into the next block at best, so
// will be mined into the next block at best, so it's height is at least
// one more than the current height.
_, curHeight, err := mp.server.db.NewestSha()
if err != nil {
return err
@ -795,8 +796,7 @@ func (mp *txMemPool) ProcessTransaction(tx *btcutil.Tx) error {
mp.Lock()
defer mp.Unlock()
txHash := tx.Sha()
log.Tracef("TXMP: Processing transaction %v", txHash)
log.Tracef("TXMP: Processing transaction %v", tx.Sha())
// Potentially accept the transaction to the memory pool.
var isOrphan bool
@ -809,7 +809,7 @@ func (mp *txMemPool) ProcessTransaction(tx *btcutil.Tx) error {
// Accept any orphan transactions that depend on this
// transaction (they are no longer orphans) and repeat for those
// accepted transactions until there are no more.
err := mp.processOrphans(txHash)
err := mp.processOrphans(tx.Sha())
if err != nil {
return err
}