From 077e1ec336ccbe911b40b51cc54ac8083be8e21c Mon Sep 17 00:00:00 2001
From: Dave Collins <davec@conformal.com>
Date: Mon, 29 Jul 2013 17:02:42 -0500
Subject: [PATCH] Improve second coinbase error message.

Include the index at which the second coinbase transaction was found.
---
 validate.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/validate.go b/validate.go
index 541bb67c..67f110c0 100644
--- a/validate.go
+++ b/validate.go
@@ -426,9 +426,11 @@ func (b *BlockChain) checkBlockSanity(block *btcutil.Block) error {
 	}
 
 	// A block must not have more than one coinbase.
-	for _, tx := range transactions[1:] {
+	for i, tx := range transactions[1:] {
 		if isCoinBase(tx) {
-			return RuleError("block contains more than one coinbase")
+			str := fmt.Sprintf("block contains second coinbase at "+
+				"index %d", i)
+			return RuleError(str)
 		}
 	}