core: short-circuit verifyInputs when there are no inputs

This commit is contained in:
Roman Khimov 2020-02-04 18:58:40 +03:00
parent 70b3839fd0
commit f9963cca37

View file

@ -306,6 +306,9 @@ func (mp *Pool) GetVerifiedTransactions() []*transaction.Transaction {
// verifyInputs is an internal unprotected version of Verify. // verifyInputs is an internal unprotected version of Verify.
func (mp *Pool) verifyInputs(tx *transaction.Transaction) bool { func (mp *Pool) verifyInputs(tx *transaction.Transaction) bool {
if len(tx.Inputs) == 0 {
return true
}
for _, item := range mp.unsortedTxn { for _, item := range mp.unsortedTxn {
for i := range item.txn.Inputs { for i := range item.txn.Inputs {
for j := 0; j < len(tx.Inputs); j++ { for j := 0; j < len(tx.Inputs); j++ {