@@ -323,8 +323,16 @@ func TestStoreRecord(t *testing.T) {
323323 // Get the current counter and check it's increased later.
324324 initialCounter := tp .requestCounter .Load ()
325325
326+ op := wire.OutPoint {
327+ Hash : chainhash.Hash {1 },
328+ Index : 0 ,
329+ }
330+ utxoIndex := map [wire.OutPoint ]int {
331+ op : 0 ,
332+ }
333+
326334 // Call the method under test.
327- requestID := tp .storeRecord (tx , req , feeFunc , fee )
335+ requestID := tp .storeRecord (tx , req , feeFunc , fee , utxoIndex )
328336
329337 // Check the request ID is as expected.
330338 require .Equal (t , initialCounter + 1 , requestID )
@@ -336,6 +344,7 @@ func TestStoreRecord(t *testing.T) {
336344 require .Equal (t , feeFunc , record .feeFunction )
337345 require .Equal (t , fee , record .fee )
338346 require .Equal (t , req , record .req )
347+ require .Equal (t , utxoIndex , record .outpointToTxIndex )
339348}
340349
341350// mockers wraps a list of mocked interfaces used inside tx publisher.
@@ -665,9 +674,17 @@ func TestTxPublisherBroadcast(t *testing.T) {
665674 feerate := chainfee .SatPerKWeight (1000 )
666675 m .feeFunc .On ("FeeRate" ).Return (feerate )
667676
677+ op := wire.OutPoint {
678+ Hash : chainhash.Hash {1 },
679+ Index : 0 ,
680+ }
681+ utxoIndex := map [wire.OutPoint ]int {
682+ op : 0 ,
683+ }
684+
668685 // Create a testing record and put it in the map.
669686 fee := btcutil .Amount (1000 )
670- requestID := tp .storeRecord (tx , req , m .feeFunc , fee )
687+ requestID := tp .storeRecord (tx , req , m .feeFunc , fee , utxoIndex )
671688
672689 // Quickly check when the requestID cannot be found, an error is
673690 // returned.
@@ -754,6 +771,14 @@ func TestRemoveResult(t *testing.T) {
754771 // Create a testing record and put it in the map.
755772 fee := btcutil .Amount (1000 )
756773
774+ op := wire.OutPoint {
775+ Hash : chainhash.Hash {1 },
776+ Index : 0 ,
777+ }
778+ utxoIndex := map [wire.OutPoint ]int {
779+ op : 0 ,
780+ }
781+
757782 testCases := []struct {
758783 name string
759784 setupRecord func () uint64
@@ -765,7 +790,9 @@ func TestRemoveResult(t *testing.T) {
765790 // removed.
766791 name : "remove on TxConfirmed" ,
767792 setupRecord : func () uint64 {
768- id := tp .storeRecord (tx , req , m .feeFunc , fee )
793+ id := tp .storeRecord (
794+ tx , req , m .feeFunc , fee , utxoIndex ,
795+ )
769796 tp .subscriberChans .Store (id , nil )
770797
771798 return id
@@ -780,7 +807,9 @@ func TestRemoveResult(t *testing.T) {
780807 // When the tx is failed, the records will be removed.
781808 name : "remove on TxFailed" ,
782809 setupRecord : func () uint64 {
783- id := tp .storeRecord (tx , req , m .feeFunc , fee )
810+ id := tp .storeRecord (
811+ tx , req , m .feeFunc , fee , utxoIndex ,
812+ )
784813 tp .subscriberChans .Store (id , nil )
785814
786815 return id
@@ -796,7 +825,9 @@ func TestRemoveResult(t *testing.T) {
796825 // Noop when the tx is neither confirmed or failed.
797826 name : "noop when tx is not confirmed or failed" ,
798827 setupRecord : func () uint64 {
799- id := tp .storeRecord (tx , req , m .feeFunc , fee )
828+ id := tp .storeRecord (
829+ tx , req , m .feeFunc , fee , utxoIndex ,
830+ )
800831 tp .subscriberChans .Store (id , nil )
801832
802833 return id
@@ -844,9 +875,17 @@ func TestNotifyResult(t *testing.T) {
844875 // Create a test tx.
845876 tx := & wire.MsgTx {LockTime : 1 }
846877
878+ op := wire.OutPoint {
879+ Hash : chainhash.Hash {1 },
880+ Index : 0 ,
881+ }
882+ utxoIndex := map [wire.OutPoint ]int {
883+ op : 0 ,
884+ }
885+
847886 // Create a testing record and put it in the map.
848887 fee := btcutil .Amount (1000 )
849- requestID := tp .storeRecord (tx , req , m .feeFunc , fee )
888+ requestID := tp .storeRecord (tx , req , m .feeFunc , fee , utxoIndex )
850889
851890 // Create a subscription to the event.
852891 subscriber := make (chan * BumpResult , 1 )
@@ -1201,9 +1240,17 @@ func TestHandleTxConfirmed(t *testing.T) {
12011240 // Create a test tx.
12021241 tx := & wire.MsgTx {LockTime : 1 }
12031242
1243+ op := wire.OutPoint {
1244+ Hash : chainhash.Hash {1 },
1245+ Index : 0 ,
1246+ }
1247+ utxoIndex := map [wire.OutPoint ]int {
1248+ op : 0 ,
1249+ }
1250+
12041251 // Create a testing record and put it in the map.
12051252 fee := btcutil .Amount (1000 )
1206- requestID := tp .storeRecord (tx , req , m .feeFunc , fee )
1253+ requestID := tp .storeRecord (tx , req , m .feeFunc , fee , utxoIndex )
12071254 record , ok := tp .records .Load (requestID )
12081255 require .True (t , ok )
12091256
@@ -1273,9 +1320,17 @@ func TestHandleFeeBumpTx(t *testing.T) {
12731320 tx : tx ,
12741321 }
12751322
1323+ op := wire.OutPoint {
1324+ Hash : chainhash.Hash {1 },
1325+ Index : 0 ,
1326+ }
1327+ utxoIndex := map [wire.OutPoint ]int {
1328+ op : 0 ,
1329+ }
1330+
12761331 // Create a testing record and put it in the map.
12771332 fee := btcutil .Amount (1000 )
1278- requestID := tp .storeRecord (tx , req , m .feeFunc , fee )
1333+ requestID := tp .storeRecord (tx , req , m .feeFunc , fee , utxoIndex )
12791334
12801335 // Create a subscription to the event.
12811336 subscriber := make (chan * BumpResult , 1 )
0 commit comments