mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-17 20:24:21 +01:00
Move redeem transactions creation client-side (#388)
* move OOR transaction creation client-side * robust redeem tx checks * optimize GetVtxos db call * rename CompleteAsyncPayment --> SubmitRedeemTx * fix permissions.go
This commit is contained in:
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/ark-network/ark/server/internal/core/domain"
|
||||
"github.com/ark-network/ark/server/internal/core/ports"
|
||||
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
)
|
||||
|
||||
@@ -25,33 +24,6 @@ func parseAddress(addr string) (*common.Address, error) {
|
||||
return common.DecodeAddress(addr)
|
||||
}
|
||||
|
||||
func parseAsyncPaymentInputs(ins []*arkv1.AsyncPaymentInput) ([]application.AsyncPaymentInput, error) {
|
||||
if len(ins) <= 0 {
|
||||
return nil, fmt.Errorf("missing inputs")
|
||||
}
|
||||
|
||||
inputs := make([]application.AsyncPaymentInput, 0, len(ins))
|
||||
for _, input := range ins {
|
||||
forfeitLeafHash, err := chainhash.NewHashFromStr(input.GetForfeitLeafHash())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid forfeit leaf hash: %s", err)
|
||||
}
|
||||
|
||||
inputs = append(inputs, application.AsyncPaymentInput{
|
||||
Input: ports.Input{
|
||||
VtxoKey: domain.VtxoKey{
|
||||
Txid: input.GetInput().GetOutpoint().GetTxid(),
|
||||
VOut: input.GetInput().GetOutpoint().GetVout(),
|
||||
},
|
||||
Tapscripts: input.GetInput().GetTapscripts().GetScripts(),
|
||||
},
|
||||
ForfeitLeafHash: *forfeitLeafHash,
|
||||
})
|
||||
}
|
||||
|
||||
return inputs, nil
|
||||
}
|
||||
|
||||
func parseNotes(notes []string) ([]note.Note, error) {
|
||||
if len(notes) <= 0 {
|
||||
return nil, fmt.Errorf("missing notes")
|
||||
|
||||
Reference in New Issue
Block a user