mirror of
https://github.com/aljazceru/ark.git
synced 2026-02-23 12:12:49 +01:00
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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user