@@ -1048,7 +1048,7 @@ func (a *covenantlessArkClient) getTransaction(ctx context.Context, txId string)
1048
1048
}
1049
1049
1050
1050
func (a * covenantlessArkClient ) listenWebsocketBoardingTxns (ctx context.Context ) {
1051
- // try to add existing boarding utxos if present
1051
+ // try to add existing boarding utxos if present during initialization
1052
1052
_ , boardingAddresses , _ , err := a .wallet .GetAddresses (ctx )
1053
1053
if err == nil {
1054
1054
for _ , boardingAddress := range boardingAddresses {
@@ -1060,7 +1060,7 @@ func (a *covenantlessArkClient) listenWebsocketBoardingTxns(ctx context.Context)
1060
1060
1061
1061
err = a .explorer .ListenAddresses (func (boaringUtxos , mempoolUtxos []explorer.WSUtxo ) error {
1062
1062
if len (mempoolUtxos ) > 0 {
1063
- newPendingBoardingTxs := make ([]types.Transaction , 0 )
1063
+ newPendingBoardingTxs := make ([]types.Transaction , len ( mempoolUtxos ) )
1064
1064
createdAt := time .Now ()
1065
1065
1066
1066
for _ , u := range mempoolUtxos {
@@ -1090,6 +1090,8 @@ func (a *covenantlessArkClient) listenWebsocketBoardingTxns(ctx context.Context)
1090
1090
}
1091
1091
}
1092
1092
1093
+ log .WithField ("rbFTransactions" , rbfTransactions ).Debugf ("replacing %d boarding transaction(s) with rbf transactions" , len (rbfTransactions ))
1094
+
1093
1095
count , err := a .store .TransactionStore ().RbfTransactions (ctx , rbfTransactions )
1094
1096
if err != nil {
1095
1097
log .WithError (err ).Error ("failed to update rbf boarding transactions" )
@@ -1100,6 +1102,8 @@ func (a *covenantlessArkClient) listenWebsocketBoardingTxns(ctx context.Context)
1100
1102
continue
1101
1103
}
1102
1104
1105
+ log .WithField ("mempool_txid" , u .Txid ).Infof ("new boarding transaction %s" , u .Txid )
1106
+
1103
1107
newPendingBoardingTxs = append (newPendingBoardingTxs , types.Transaction {
1104
1108
TransactionKey : types.TransactionKey {
1105
1109
BoardingTxid : u .Txid ,
@@ -1130,6 +1134,30 @@ func (a *covenantlessArkClient) listenWebsocketBoardingTxns(ctx context.Context)
1130
1134
)
1131
1135
if err != nil {
1132
1136
log .WithError (err ).Error ("failed to update boarding transactions" )
1137
+ return err
1138
+ }
1139
+ // ensure that we add transactions that were not in memepool
1140
+ // but were confirmed in the blockchain
1141
+ if count != len (boaringUtxos ) {
1142
+ newPendingBoardingTxs := make ([]types.Transaction , len (boaringUtxos ))
1143
+ for _ , u := range boaringUtxos {
1144
+ newPendingBoardingTxs = append (newPendingBoardingTxs , types.Transaction {
1145
+ TransactionKey : types.TransactionKey {
1146
+ BoardingTxid : u .Txid ,
1147
+ },
1148
+ Amount : u .Value ,
1149
+ Type : types .TxReceived ,
1150
+ CreatedAt : time .Now (),
1151
+ })
1152
+ }
1153
+ count , err = a .store .TransactionStore ().AddTransactions (
1154
+ ctx , newPendingBoardingTxs ,
1155
+ )
1156
+ if err != nil {
1157
+ log .WithError (err ).Error ("failed to add new boarding transactions" )
1158
+ return err
1159
+ }
1160
+
1133
1161
}
1134
1162
log .Debugf ("confirmed %d boarding transaction(s)" , count )
1135
1163
}
0 commit comments