Add reversible policy to pending vtxos (#311)

* [server] descriptor-based vtxo script

* [server] fix unit tests

* [sdk] descriptor based vtxo

* empty config check & version flag support

* fix: empty config check & version flag support (#309)

* fix

* [sdk] several fixes

* [sdk][server] several fixes

* [common][sdk] add reversible VtxoScript type, use it in async payment

* [common] improve parser

* [common] fix reversible vtxo parser

* [sdk] remove logs

* fix forfeit map

* remove debug log

* [sdk] do not allow reversible vtxo script in case of self-transfer

* remove signing pubkey

* remove signer public key, craft forfeit txs client side

* go work sync

* fix linter errors

* rename MakeForfeitTxs to BuildForfeitTxs

* fix conflicts

* fix tests

* comment VtxoScript type

* revert ROUND_INTERVAL value

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Co-authored-by: sekulicd <sekula87@gmail.com>
This commit is contained in:
Louis Singer
2024-09-19 10:01:33 +02:00
committed by GitHub
parent 7a83f9957e
commit 10ef0dbffa
82 changed files with 3440 additions and 2612 deletions

View File

@@ -165,7 +165,7 @@ func (r *roundRepository) AddOrUpdateRound(ctx context.Context, round domain.Rou
ctx,
queries.UpsertReceiverParams{
PaymentID: payment.Id,
Pubkey: receiver.Pubkey,
Descriptor: receiver.Descriptor,
Amount: int64(receiver.Amount),
OnchainAddress: receiver.OnchainAddress,
},
@@ -320,7 +320,7 @@ func (r *roundRepository) GetSweptRounds(ctx context.Context) ([]domain.Round, e
func rowToReceiver(row queries.PaymentReceiverVw) domain.Receiver {
return domain.Receiver{
Pubkey: row.Pubkey.String,
Descriptor: row.Descriptor.String,
Amount: uint64(row.Amount.Int64),
OnchainAddress: row.OnchainAddress.String,
}
@@ -413,8 +413,8 @@ func readRoundRows(rows []roundPaymentTxReceiverVtxoRow) ([]*domain.Round, error
found := false
for _, rcv := range payment.Receivers {
if v.receiver.Pubkey.Valid && v.receiver.Amount.Valid {
if rcv.Pubkey == v.receiver.Pubkey.String && int64(rcv.Amount) == v.receiver.Amount.Int64 {
if v.receiver.Descriptor.Valid && v.receiver.Amount.Valid {
if rcv.Descriptor == v.receiver.Descriptor.String && int64(rcv.Amount) == v.receiver.Amount.Int64 {
found = true
break
}
@@ -470,8 +470,8 @@ func rowToPaymentVtxoVw(row queries.PaymentVtxoVw) domain.Vtxo {
VOut: uint32(row.Vout.Int64),
},
Receiver: domain.Receiver{
Pubkey: row.Pubkey.String,
Amount: uint64(row.Amount.Int64),
Descriptor: row.Descriptor.String,
Amount: uint64(row.Amount.Int64),
},
PoolTx: row.PoolTx.String,
SpentBy: row.SpentBy.String,