@@ -710,7 +710,7 @@ func testPaymentMgrPayment(t *testing.T) {
710710 mPmts [zeroSource .Coinbase ] = []* Payment {pmtA }
711711 pmtB = NewPayment (yID , randSource , amt , height , estMaturity )
712712 mPmts [randSource .Coinbase ] = []* Payment {pmtB }
713- treasuryActive := true
713+ coinbaseIndex := uint32 ( 1 )
714714
715715 // Ensure generating payout tx details returns an error if fetching txOut
716716 // information fails.
@@ -720,7 +720,7 @@ func testPaymentMgrPayment(t *testing.T) {
720720 },
721721 }
722722 _ , _ , _ , _ , err = mgr .generatePayoutTxDetails (ctx , txC , poolFeeAddrs ,
723- mPmts , treasuryActive )
723+ mPmts , coinbaseIndex )
724724 if ! errors .Is (err , errs .TxOut ) {
725725 cancel ()
726726 t .Fatalf ("expected a fetch txOut error, got %v" , err )
@@ -740,7 +740,7 @@ func testPaymentMgrPayment(t *testing.T) {
740740 }
741741
742742 _ , _ , _ , _ , err = mgr .generatePayoutTxDetails (ctx , txC , poolFeeAddrs ,
743- mPmts , treasuryActive )
743+ mPmts , coinbaseIndex )
744744 if ! errors .Is (err , errs .Coinbase ) {
745745 cancel ()
746746 t .Fatalf ("expected a spendable error" )
@@ -764,7 +764,7 @@ func testPaymentMgrPayment(t *testing.T) {
764764 }
765765
766766 _ , _ , _ , _ , err = mgr .generatePayoutTxDetails (ctx , txC , poolFeeAddrs ,
767- mPmts , treasuryActive )
767+ mPmts , coinbaseIndex )
768768 if ! errors .Is (err , errs .ValueNotFound ) {
769769 cancel ()
770770 t .Fatalf ("expected an account not found error" )
@@ -785,7 +785,7 @@ func testPaymentMgrPayment(t *testing.T) {
785785 }
786786
787787 _ , _ , _ , _ , err = mgr .generatePayoutTxDetails (ctx , txC , poolFeeAddrs ,
788- mPmts , treasuryActive )
788+ mPmts , coinbaseIndex )
789789 if ! errors .Is (err , errs .CreateTx ) {
790790 cancel ()
791791 t .Fatalf ("expected an input output mismatch error" )
@@ -806,7 +806,7 @@ func testPaymentMgrPayment(t *testing.T) {
806806 }
807807
808808 _ , _ , _ , _ , err = mgr .generatePayoutTxDetails (ctx , txC , poolFeeAddrs ,
809- mPmts , treasuryActive )
809+ mPmts , coinbaseIndex )
810810 if ! errors .Is (err , errs .CreateTx ) {
811811 cancel ()
812812 t .Fatalf ("expected an unclaimed input value error, got %v" , err )
@@ -826,7 +826,7 @@ func testPaymentMgrPayment(t *testing.T) {
826826
827827 inputs , inputTxHashes , outputs , _ , err := mgr .generatePayoutTxDetails (ctx ,
828828 txC , poolFeeAddrs ,
829- mPmts , treasuryActive )
829+ mPmts , coinbaseIndex )
830830 if err != nil {
831831 cancel ()
832832 t .Fatalf ("unexpected payout tx details error, got %v" , err )
@@ -897,7 +897,7 @@ func testPaymentMgrPayment(t *testing.T) {
897897
898898 // Ensure dividend payments returns no error if there are no mature
899899 // payments to work with.
900- err = mgr .payDividends (ctx , estMaturity - 1 , treasuryActive )
900+ err = mgr .payDividends (ctx , estMaturity - 1 , coinbaseIndex )
901901 if err != nil {
902902 cancel ()
903903 t .Fatal ("expected no error since there are no mature payments" )
@@ -907,7 +907,7 @@ func testPaymentMgrPayment(t *testing.T) {
907907 // fetched.
908908 mgr .cfg .TxCreator = nil
909909
910- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
910+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
911911 if ! errors .Is (err , errs .Disconnected ) {
912912 cancel ()
913913 t .Fatalf ("expected a nil tx creator error, got %v" , err )
@@ -920,7 +920,7 @@ func testPaymentMgrPayment(t *testing.T) {
920920 return - 1 , fmt .Errorf ("unable to confirm blocks" )
921921 }
922922
923- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
923+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
924924 if err == nil {
925925 cancel ()
926926 t .Fatalf ("expected a prune orphan payments error" )
@@ -945,7 +945,7 @@ func testPaymentMgrPayment(t *testing.T) {
945945 },
946946 }
947947
948- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
948+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
949949 if ! errors .Is (err , errs .TxOut ) {
950950 cancel ()
951951 t .Fatalf ("expected a generate payout tx details error, got %v" , err )
@@ -957,7 +957,7 @@ func testPaymentMgrPayment(t *testing.T) {
957957 return - 1 , nil
958958 }
959959
960- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
960+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
961961 if ! errors .Is (err , errs .TxIn ) {
962962 cancel ()
963963 t .Fatalf ("expected an apply tx fee error, got %v" , err )
@@ -978,7 +978,7 @@ func testPaymentMgrPayment(t *testing.T) {
978978 return int64 (estMaturity ) + 1 , nil
979979 }
980980
981- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
981+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
982982 if err == nil {
983983 cancel ()
984984 t .Fatalf ("expected a coinbase confirmation error, got %v" , err )
@@ -1005,7 +1005,7 @@ func testPaymentMgrPayment(t *testing.T) {
10051005
10061006 mgr .cfg .CoinbaseConfTimeout = time .Millisecond * 500
10071007
1008- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
1008+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
10091009 if err == nil {
10101010 cancel ()
10111011 t .Fatal ("expected a create transaction error" )
@@ -1032,7 +1032,7 @@ func testPaymentMgrPayment(t *testing.T) {
10321032 mgr .cfg .TxBroadcaster = nil
10331033 mgr .cfg .WalletPass = "123"
10341034
1035- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
1035+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
10361036 if ! errors .Is (err , errs .Disconnected ) {
10371037 cancel ()
10381038 t .Fatalf ("expected a fetch tx broadcaster error, got %v" , err )
@@ -1065,7 +1065,7 @@ func testPaymentMgrPayment(t *testing.T) {
10651065 },
10661066 }
10671067
1068- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
1068+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
10691069 if ! errors .Is (err , errs .SignTx ) {
10701070 cancel ()
10711071 t .Fatalf ("expected a signing error, got %v" , err )
@@ -1098,7 +1098,7 @@ func testPaymentMgrPayment(t *testing.T) {
10981098 },
10991099 }
11001100
1101- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
1101+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
11021102 if ! errors .Is (err , errs .PublishTx ) {
11031103 cancel ()
11041104 t .Fatalf ("expected a publish error, got %v" , err )
@@ -1128,7 +1128,7 @@ func testPaymentMgrPayment(t *testing.T) {
11281128
11291129 atomic .StoreUint32 (& mgr .failedTxConfs , maxTxConfThreshold )
11301130
1131- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
1131+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
11321132 if ! errors .Is (err , errs .Rescan ) {
11331133 cancel ()
11341134 t .Fatalf ("expected a rescan error, got %v" , err )
@@ -1157,7 +1157,7 @@ func testPaymentMgrPayment(t *testing.T) {
11571157 },
11581158 }
11591159
1160- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
1160+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
11611161 if ! errors .Is (err , errs .Rescan ) {
11621162 cancel ()
11631163 t .Fatalf ("expected a rescan error, got %v" , err )
@@ -1172,7 +1172,7 @@ func testPaymentMgrPayment(t *testing.T) {
11721172
11731173 // Ensure dividend payment returns an error when there are no tx
11741174 // confirmation hashes to rescan.
1175- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
1175+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
11761176 if ! errors .Is (err , errs .TxConf ) {
11771177 cancel ()
11781178 t .Fatalf ("expected a no tx conf error, got %v" , err )
@@ -1208,7 +1208,7 @@ func testPaymentMgrPayment(t *testing.T) {
12081208 },
12091209 }
12101210
1211- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
1211+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
12121212 if ! errors .Is (err , errs .PublishTx ) {
12131213 cancel ()
12141214 t .Fatalf ("expected a publish error, got %v" , err )
@@ -1242,7 +1242,7 @@ func testPaymentMgrPayment(t *testing.T) {
12421242 },
12431243 }
12441244
1245- err = mgr .payDividends (ctx , estMaturity + 1 , treasuryActive )
1245+ err = mgr .payDividends (ctx , estMaturity + 1 , coinbaseIndex )
12461246 if err != nil {
12471247 cancel ()
12481248 t .Fatalf ("unexpected dividend payment error, got %v" , err )
@@ -1459,9 +1459,9 @@ func testPaymentMgrSignals(t *testing.T) {
14591459 // Ensure the payment lifecycle process receives the payment signal and
14601460 // processes mature payments.
14611461 msgA := paymentMsg {
1462- CurrentHeight : estMaturity + 1 ,
1463- TreasuryActive : false ,
1464- Done : make (chan struct {}),
1462+ CurrentHeight : estMaturity + 1 ,
1463+ CoinbaseIndex : 2 ,
1464+ Done : make (chan struct {}),
14651465 }
14661466
14671467 var wg sync.WaitGroup
@@ -1491,9 +1491,9 @@ func testPaymentMgrSignals(t *testing.T) {
14911491 }
14921492
14931493 msgB := paymentMsg {
1494- CurrentHeight : estMaturity + 1 ,
1495- TreasuryActive : false ,
1496- Done : make (chan struct {}),
1494+ CurrentHeight : estMaturity + 1 ,
1495+ CoinbaseIndex : 2 ,
1496+ Done : make (chan struct {}),
14971497 }
14981498 mgr .processPayments (ctx , & msgB )
14991499 <- msgB .Done
0 commit comments