40
40
// preparation, usually due to the output being dust.
41
41
ErrTxNoOutput = errors .New ("tx has no output" )
42
42
43
- // ErrThirdPartySpent is returned when a third party has spent the
44
- // input in the sweeping tx.
45
- ErrThirdPartySpent = errors .New ("third party spent the output " )
43
+ // ErrUnknownSpent is returned when an unknown tx has spent an input in
44
+ // the sweeping tx.
45
+ ErrUnknownSpent = errors .New ("unknown spend of input " )
46
46
)
47
47
48
48
var (
@@ -81,10 +81,6 @@ const (
81
81
// bumper. In either case the inputs in this tx should be retried with
82
82
// either a different grouping strategy or an increased budget.
83
83
//
84
- // NOTE: We also send this event when there's a third party spend
85
- // event, and the sweeper will handle cleaning this up once it's
86
- // confirmed.
87
- //
88
84
// TODO(yy): Remove the above usage once we remove sweeping non-CPFP
89
85
// anchors.
90
86
TxFailed
@@ -929,7 +925,7 @@ func (t *TxPublisher) processRecords() {
929
925
930
926
// Check whether the inputs has been spent by a unknown
931
927
// tx.
932
- if t .isThirdPartySpent (r , spends ) {
928
+ if t .isUnknownSpent (r , spends ) {
933
929
failedRecords [requestID ] = r
934
930
935
931
// Move to the next record.
@@ -989,7 +985,7 @@ func (t *TxPublisher) processRecords() {
989
985
// result.
990
986
for _ , r := range failedRecords {
991
987
t .wg .Add (1 )
992
- go t .handleThirdPartySpent (r )
988
+ go t .handleUnknownSpent (r )
993
989
}
994
990
}
995
991
@@ -1151,12 +1147,12 @@ func (t *TxPublisher) handleFeeBumpTx(r *monitorRecord, currentHeight int32) {
1151
1147
})
1152
1148
}
1153
1149
1154
- // handleThirdPartySpent is called when the inputs in an unconfirmed tx is
1155
- // spent. It will notify the subscriber then remove the record from the maps
1156
- // and send a TxFailed event to the subscriber.
1150
+ // handleUnknownSpent is called when the inputs are spent by a unknown tx. It
1151
+ // will notify the subscriber then remove the record from the maps and send a
1152
+ // TxUnknownSpend event to the subscriber.
1157
1153
//
1158
1154
// NOTE: Must be run as a goroutine to avoid blocking on sending the result.
1159
- func (t * TxPublisher ) handleThirdPartySpent (r * monitorRecord ) {
1155
+ func (t * TxPublisher ) handleUnknownSpent (r * monitorRecord ) {
1160
1156
defer t .wg .Done ()
1161
1157
1162
1158
log .Debugf ("Record %v has inputs spent by a tx unknown to the fee " +
@@ -1169,7 +1165,7 @@ func (t *TxPublisher) handleThirdPartySpent(r *monitorRecord) {
1169
1165
Event : TxUnknownSpend ,
1170
1166
Tx : r .tx ,
1171
1167
requestID : r .requestID ,
1172
- Err : ErrThirdPartySpent ,
1168
+ Err : ErrUnknownSpent ,
1173
1169
}
1174
1170
1175
1171
// Notify that this tx is confirmed and remove the record from the map.
@@ -1277,10 +1273,11 @@ func (t *TxPublisher) createAndPublishTx(
1277
1273
return fn .Some (* result )
1278
1274
}
1279
1275
1280
- // isThirdPartySpent checks whether the inputs of the tx has already been spent
1281
- // by a third party. When a tx is not confirmed, yet its inputs has been spent,
1282
- // then it must be spent by a different tx other than the sweeping tx here.
1283
- func (t * TxPublisher ) isThirdPartySpent (r * monitorRecord ,
1276
+ // isUnknownSpent checks whether the inputs of the tx has already been spent by
1277
+ // a tx not known to us. When a tx is not confirmed, yet its inputs has been
1278
+ // spent, then it must be spent by a different tx other than the sweeping tx
1279
+ // here.
1280
+ func (t * TxPublisher ) isUnknownSpent (r * monitorRecord ,
1284
1281
spends map [wire.OutPoint ]* wire.MsgTx ) bool {
1285
1282
1286
1283
txid := r .tx .TxHash ()
@@ -1290,14 +1287,14 @@ func (t *TxPublisher) isThirdPartySpent(r *monitorRecord,
1290
1287
for op , spendingTx := range spends {
1291
1288
spendingTxID := spendingTx .TxHash ()
1292
1289
1293
- // If the spending tx is the same as the sweeping tx
1294
- // then we are good.
1290
+ // If the spending tx is the same as the sweeping tx then we are
1291
+ // good.
1295
1292
if spendingTxID == txid {
1296
1293
continue
1297
1294
}
1298
1295
1299
- log .Warnf ("Detected third party spent of output =%v " +
1300
- "in tx=%v" , op , spendingTx .TxHash ())
1296
+ log .Warnf ("Detected unknown spend of input =%v in tx=%v" , op ,
1297
+ spendingTx .TxHash ())
1301
1298
1302
1299
return true
1303
1300
}
0 commit comments