diff --git a/src/main.go b/src/main.go index a1aefcd..141cba0 100644 --- a/src/main.go +++ b/src/main.go @@ -56,12 +56,12 @@ func UpdateValidTxns() { if err != nil { panic(err) } - if(isValid){ + if(isValid && !transaction.Vin[0].IsCoinbase){ fileName := fmt.Sprintf("%s/%s", ValidTxnsDirPath, f.Name()) os.WriteFile(fileName, byteResult, fs.FileMode(ValidTxnsDirPerm)) validTxnsCount += 1 } - if(validTxnsCount > 20){ + if(validTxnsCount > 15){ break } } diff --git a/src/mining/mining.go b/src/mining/mining.go index 413911c..ebd83b8 100644 --- a/src/mining/mining.go +++ b/src/mining/mining.go @@ -121,11 +121,8 @@ func SelectTransactionsFromFolder(validTxnsFolderPath string) []*txn.Transaction } txnSlice := make([]*txn.Transaction, 0) - for i, f := range files { + for _, f := range files { var transaction txn.Transaction - if(i == 100) { - return txnSlice - } txnPath := fmt.Sprintf("%s/%s", validTxnsFolderPath, f.Name()) byteResult, _ := os.ReadFile(txnPath) err = json.Unmarshal(byteResult, &transaction)