Improve second coinbase error message.

Include the index at which the second coinbase transaction was found.
This commit is contained in:
Dave Collins 2013-07-29 17:02:42 -05:00
parent 882d1c1687
commit 077e1ec336

View file

@ -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)
}
}