2015-05-01 08:28:01 +02:00
|
|
|
// Copyright (c) 2015 The btcsuite developers
|
2015-03-10 06:41:19 +01:00
|
|
|
// Use of this source code is governed by an ISC
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2017-08-20 02:21:36 +02:00
|
|
|
package blockchain
|
2015-03-10 06:41:19 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
// BenchmarkIsCoinBase performs a simple benchmark against the IsCoinBase
|
|
|
|
// function.
|
|
|
|
func BenchmarkIsCoinBase(b *testing.B) {
|
2021-08-19 20:41:48 +02:00
|
|
|
tx, _ := GetBlock100000().Tx(1)
|
2015-03-10 06:41:19 +01:00
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
2017-08-20 02:21:36 +02:00
|
|
|
IsCoinBase(tx)
|
2015-03-10 06:41:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// BenchmarkIsCoinBaseTx performs a simple benchmark against the IsCoinBaseTx
|
|
|
|
// function.
|
|
|
|
func BenchmarkIsCoinBaseTx(b *testing.B) {
|
2021-08-19 20:41:48 +02:00
|
|
|
tx, _ := GetBlock100000().Tx(1)
|
2015-03-10 06:41:19 +01:00
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
2021-08-19 20:41:48 +02:00
|
|
|
IsCoinBaseTx(tx.MsgTx())
|
2015-03-10 06:41:19 +01:00
|
|
|
}
|
|
|
|
}
|