mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-18 20:54:20 +01:00
Change representation of taproot trees & Internal fixes (#384)
* migrate descriptors --> tapscripts * fix covenantless * dynamic boarding exit delay * remove duplicates in tree and bitcointree * agnostic signatures validation * revert GetInfo change * renaming VtxoScript var * Agnostic script server (#6) * Hotfix: Prevent ZMQ-based bitcoin wallet to panic (#383) * Hotfix bct embedded wallet w/ ZMQ * Fixes * Rename vtxo is_oor to is_pending (#385) * Rename vtxo is_oor > is_pending * Clean swaggers * Revert changes to client and sdk * descriptor in oneof * support CHECKSIG_ADD in MultisigClosure * use right witness size in OOR tx fee estimation * Revert changes --------- Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
This commit is contained in:
@@ -3,9 +3,12 @@ package handlers
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
arkv1 "github.com/ark-network/ark/api-spec/protobuf/gen/ark/v1"
|
||||
"github.com/ark-network/ark/common/bitcointree"
|
||||
"github.com/ark-network/ark/common/descriptor"
|
||||
"github.com/ark-network/ark/server/internal/core/application"
|
||||
"github.com/ark-network/ark/server/internal/core/domain"
|
||||
"github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
@@ -43,6 +46,15 @@ func (h *handler) GetInfo(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
desc := fmt.Sprintf(
|
||||
descriptor.DefaultVtxoDescriptorTemplate,
|
||||
hex.EncodeToString(bitcointree.UnspendableKey().SerializeCompressed()),
|
||||
"USER",
|
||||
info.PubKey,
|
||||
info.UnilateralExitDelay,
|
||||
info.PubKey,
|
||||
)
|
||||
|
||||
return &arkv1.GetInfoResponse{
|
||||
Pubkey: info.PubKey,
|
||||
RoundLifetime: info.RoundLifetime,
|
||||
@@ -50,8 +62,9 @@ func (h *handler) GetInfo(
|
||||
RoundInterval: info.RoundInterval,
|
||||
Network: info.Network,
|
||||
Dust: int64(info.Dust),
|
||||
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
|
||||
ForfeitAddress: info.ForfeitAddress,
|
||||
BoardingDescriptorTemplate: desc,
|
||||
VtxoDescriptorTemplates: []string{desc},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -73,14 +86,18 @@ func (h *handler) GetBoardingAddress(
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid pubkey (parse error)")
|
||||
}
|
||||
|
||||
addr, descriptor, err := h.svc.GetBoardingAddress(ctx, userPubkey)
|
||||
addr, tapscripts, err := h.svc.GetBoardingAddress(ctx, userPubkey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.GetBoardingAddressResponse{
|
||||
Address: addr,
|
||||
Descriptor_: descriptor,
|
||||
Address: addr,
|
||||
TaprootTree: &arkv1.GetBoardingAddressResponse_Tapscripts{
|
||||
Tapscripts: &arkv1.Tapscripts{
|
||||
Scripts: tapscripts,
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ func parseAsyncPaymentInputs(ins []*arkv1.AsyncPaymentInput) ([]application.Asyn
|
||||
Txid: input.GetInput().GetOutpoint().GetTxid(),
|
||||
VOut: input.GetInput().GetOutpoint().GetVout(),
|
||||
},
|
||||
Descriptor: input.GetInput().GetDescriptor_(),
|
||||
Tapscripts: input.GetInput().GetTapscripts().GetScripts(),
|
||||
},
|
||||
ForfeitLeafHash: *forfeitLeafHash,
|
||||
})
|
||||
@@ -82,7 +82,7 @@ func parseInputs(ins []*arkv1.Input) ([]ports.Input, error) {
|
||||
Txid: input.GetOutpoint().GetTxid(),
|
||||
VOut: input.GetOutpoint().GetVout(),
|
||||
},
|
||||
Descriptor: input.GetDescriptor_(),
|
||||
Tapscripts: input.GetTapscripts().GetScripts(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user