async Task <(string txHex, Transaction txId, PrevOut[] prevOuts)> CreateNewConsolidationTx(string reason = "")
        {
            var   address       = BitcoinAddress.Create(testAddress, Network.RegTest);
            var   tx            = BCash.Instance.Regtest.CreateTransaction();
            Money value         = 0L;
            int   inCount       = 0;
            var   OP_NOP_string = "61";
            var   key           = Key.Parse(testPrivateKeyWif, Network.RegTest);
            int   noBlocks      = (int)consolidationParameters.MinConsolidationInputMaturity - 1;

            if (reason == "inputMaturity")
            {
                noBlocks--;
            }

            await rpcClient0.GenerateAsync(noBlocks);

            if (reason == "inputScriptSize")
            {
                Coin coin = availableCoins.Dequeue();
                tx.Inputs.Add(new TxIn(coin.Outpoint));
                tx.Sign(key.GetBitcoinSecret(Network.RegTest), coin);

                var      sig = tx.Inputs[0].ScriptSig;
                string[] arr = new string[(int)consolidationParameters.MaxConsolidationInputScriptSize + 1 - sig.Length];
                Array.Fill(arr, OP_NOP_string);
                var sighex = string.Concat(arr) + sig.ToHex();
                tx.Inputs[0] = new TxIn(coin.Outpoint, Script.FromHex(sighex));

                value += coin.Amount;
                inCount++;
            }

            foreach (Coin coin in availableCoins)
            {
                tx.Inputs.Add(new TxIn(coin.Outpoint));

                value += coin.Amount;
                inCount++;

                if (reason == "ratioInOutCount" && inCount == consolidationParameters.MinConsolidationFactor - 1)
                {
                    break;
                }
            }
            if (reason == "ratioInOutScriptSize")
            {
                string coinPubKey = availableCoins.ElementAt(0).ScriptPubKey.ToHex();
                tx.Outputs.Add(value, Script.FromHex(OP_NOP_string + coinPubKey));
            }
            else
            {
                tx.Outputs.Add(value, address);
            }
            tx.Sign(key.GetBitcoinSecret(Network.RegTest), availableCoins);

            var spendOutputs = tx.Inputs.Select(x => (txId: x.PrevOut.Hash.ToString(), N: (long)x.PrevOut.N)).ToArray();

            var(_, prevOuts) = await Mapi.CollectPreviousOuputs(tx, null, RpcMultiClient);

            return(tx.ToHex(), tx, prevOuts);
        }