mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-17 04:04:21 +01:00
* Rename asp > server * Rename pool > round * Consolidate naming for pubkey/prvkey vars and types * Fix * Fix * Fix wasm * Rename congestionTree > vtxoTree * Fix wasm * Rename payment > request * Rename congestionTree > vtxoTree after syncing with master * Fix Send API in SDK * Fix wasm * Fix wasm * Fixes * Fixes after review * Fix * Fix naming * Fix * Fix e2e tests
45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
/*
|
|
* This package contains intermediary events that are used only by the covenantless version
|
|
* they let to sign the vtxo tree using musig2 algorithm
|
|
* they are not included in domain because they don't mutate the Round state and should not be persisted
|
|
*/
|
|
package application
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/hex"
|
|
|
|
"github.com/ark-network/ark/common/bitcointree"
|
|
"github.com/ark-network/ark/common/tree"
|
|
"github.com/decred/dcrd/dcrec/secp256k1/v4"
|
|
)
|
|
|
|
// signer should react to this event by generating a musig2 nonce for each transaction in the tree
|
|
type RoundSigningStarted struct {
|
|
Id string
|
|
UnsignedVtxoTree tree.VtxoTree
|
|
Cosigners []*secp256k1.PublicKey
|
|
UnsignedRoundTx string
|
|
}
|
|
|
|
// signer should react to this event by partially signing the vtxo tree transactions
|
|
// then, delete its ephemeral key
|
|
type RoundSigningNoncesGenerated struct {
|
|
Id string
|
|
Nonces bitcointree.TreeNonces // aggregated nonces
|
|
}
|
|
|
|
func (e RoundSigningNoncesGenerated) SerializeNonces() (string, error) {
|
|
var serialized bytes.Buffer
|
|
|
|
if err := e.Nonces.Encode(&serialized); err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return hex.EncodeToString(serialized.Bytes()), nil
|
|
}
|
|
|
|
// implement domain.RoundEvent interface
|
|
func (r RoundSigningStarted) IsEvent() {}
|
|
func (r RoundSigningNoncesGenerated) IsEvent() {}
|