mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-18 12:44:19 +01:00
Add support for unilateral exit (#79)
* v0 unilateral redemption * add fee outputs to congestion tree * unilateral exit * rework unilateral exit verbosity * substract fee from vtxo amount * remove unused functions and variables * fix after reviews * Update noah/explorer.go Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com> Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com> * remove bufferutils --------- Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com> Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
This commit is contained in:
@@ -150,6 +150,7 @@ func (b *txBuilder) BuildPoolTx(
|
||||
aspPubkey *secp256k1.PublicKey,
|
||||
wallet ports.WalletService,
|
||||
payments []domain.Payment,
|
||||
minRelayFee uint64,
|
||||
) (poolTx string, congestionTree domain.CongestionTree, err error) {
|
||||
aspScriptBytes, err := p2wpkhScript(aspPubkey, b.net)
|
||||
if err != nil {
|
||||
@@ -159,17 +160,16 @@ func (b *txBuilder) BuildPoolTx(
|
||||
aspScript := hex.EncodeToString(aspScriptBytes)
|
||||
|
||||
offchainReceivers, onchainReceivers := receiversFromPayments(payments)
|
||||
sharedOutputAmount := sumReceivers(offchainReceivers)
|
||||
|
||||
numberOfConnectors := numberOfVTXOs(payments)
|
||||
connectorOutputAmount := connectorAmount * numberOfConnectors
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
makeTree, sharedOutputScript, err := buildCongestionTree(
|
||||
makeTree, sharedOutputScript, sharedOutputAmount, err := buildCongestionTree(
|
||||
b.net,
|
||||
aspPubkey,
|
||||
offchainReceivers,
|
||||
minRelayFee,
|
||||
)
|
||||
if err != nil {
|
||||
return
|
||||
@@ -273,14 +273,6 @@ func receiversFromPayments(
|
||||
return
|
||||
}
|
||||
|
||||
func sumReceivers(receivers []domain.Receiver) uint64 {
|
||||
var sum uint64
|
||||
for _, r := range receivers {
|
||||
sum += r.Amount
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
type output struct {
|
||||
script string
|
||||
amount uint64
|
||||
|
||||
Reference in New Issue
Block a user