Drop unconditional forfeits txs in offline payment (#344)

* remove unconditionnal forfeit tx

* fix sqlite vtxo repo

* remove pendingData struct

* delete uncond_forfeits_tx table
This commit is contained in:
Louis Singer
2024-10-04 18:06:00 +02:00
committed by GitHub
parent 1d40892196
commit 7606b4cd00
33 changed files with 1654 additions and 1041 deletions

View File

@@ -362,7 +362,7 @@ func (h *handler) CreatePayment(
}
}
redeemTx, unconditionalForfeitTxs, err := h.svc.CreateAsyncPayment(
redeemTx, err := h.svc.CreateAsyncPayment(
ctx, inputs, receivers,
)
if err != nil {
@@ -370,8 +370,7 @@ func (h *handler) CreatePayment(
}
return &arkv1.CreatePaymentResponse{
SignedRedeemTx: redeemTx,
UsignedUnconditionalForfeitTxs: unconditionalForfeitTxs,
SignedRedeemTx: redeemTx,
}, nil
}
@@ -382,12 +381,8 @@ func (h *handler) CompletePayment(
return nil, status.Error(codes.InvalidArgument, "missing signed redeem tx")
}
if len(req.GetSignedUnconditionalForfeitTxs()) <= 0 {
return nil, status.Error(codes.InvalidArgument, "missing signed unconditional forfeit txs")
}
if err := h.svc.CompleteAsyncPayment(
ctx, req.GetSignedRedeemTx(), req.GetSignedUnconditionalForfeitTxs(),
ctx, req.GetSignedRedeemTx(),
); err != nil {
return nil, err
}

View File

@@ -65,13 +65,6 @@ type vtxoList []domain.Vtxo
func (v vtxoList) toProto() []*arkv1.Vtxo {
list := make([]*arkv1.Vtxo, 0, len(v))
for _, vv := range v {
var pendingData *arkv1.PendingPayment
if vv.AsyncPayment != nil {
pendingData = &arkv1.PendingPayment{
RedeemTx: vv.AsyncPayment.RedeemTx,
UnconditionalForfeitTxs: vv.AsyncPayment.UnconditionalForfeitTxs,
}
}
list = append(list, &arkv1.Vtxo{
Outpoint: &arkv1.Outpoint{
Txid: vv.Txid,
@@ -84,7 +77,7 @@ func (v vtxoList) toProto() []*arkv1.Vtxo {
ExpireAt: vv.ExpireAt,
SpentBy: vv.SpentBy,
Swept: vv.Swept,
PendingData: pendingData,
RedeemTx: vv.RedeemTx,
Pending: vv.Pending,
})
}