package multisend

import (
	"fmt"
	sync "sync"
	"testing"
	"time"
)

func TestProduceTx(t *testing.T) {

	//StartProduceTx()
	//ProduceOriginalTx()

	wg := sync.WaitGroup{}

	wg.Add(2)

	go func() {
		defer wg.Done()
		if err := ProduceOriginalTx(); err != nil {
			fmt.Printf("ProduceOriginalTx stop err: %s\n", err.Error())
		}

	}()

	for {
		if len(batchTxsForRedis) >= batchTxHashSize*batchTxHashQueueSize {
			break
		}

		t.Logf("waiting for produce original tx, len(originalTxsForRedis):%d \n", len(batchTxsForRedis))
		time.Sleep(2 * time.Second)
	}

	// go func() {
	// 	defer wg.Done()
	// 	Start()
	// }()

	wg.Wait()
}
