Drop PendingChange field (#331)

* Drop pending_change

* Fixes

* Polish

* Fallback to psbt string
This commit is contained in:
Pietralberto Mazza
2024-09-26 14:56:20 +02:00
committed by GitHub
parent 2be78b0115
commit b15c0868b2
23 changed files with 522 additions and 454 deletions

View File

@@ -265,7 +265,7 @@ func (s *covenantlessService) CompleteAsyncPayment(
for outIndex, out := range redeemPtx.UnsignedTx.TxOut {
desc := asyncPayData.receivers[outIndex].Descriptor
_, _, _, _, err := descriptor.ParseReversibleVtxoDescriptor(desc)
isChange := err != nil
isPending := err == nil
vtxos = append(vtxos, domain.Vtxo{
VtxoKey: domain.VtxoKey{
@@ -281,7 +281,7 @@ func (s *covenantlessService) CompleteAsyncPayment(
RedeemTx: redeemTx,
UnconditionalForfeitTxs: unconditionalForfeitTxs,
},
PendingChange: isChange,
Pending: isPending,
})
}
@@ -337,7 +337,7 @@ func (s *covenantlessService) CreateAsyncPayment(
if vtxo.Swept {
return "", nil, fmt.Errorf("all vtxos must be swept")
}
if vtxo.AsyncPayment != nil && !vtxo.PendingChange {
if vtxo.Pending {
return "", nil, fmt.Errorf("all vtxos must be claimed")
}