Skip to main content

pool

import "github.com/bsv8/go-bitfs/pool"

Package pool contains the protocol-independent 2-of-3 settlement primitives used by 002, 005, and 006. It validates role-ordered MultisigPool v4 bytes, tracks monotonic payment state, and exposes storage/node ports; it deliberately does not import BitFS quote or content types.

Index

Constants

const (
// KindPoolRefundPresignRequest is the CBOR tag for a refund presign request.
KindPoolRefundPresignRequest uint64 = 12
// KindPoolRefundPresignResponse identifies a refund signature response.
KindPoolRefundPresignResponse uint64 = 13
// KindPoolFundingTxDelivery identifies a funding transaction delivery.
KindPoolFundingTxDelivery uint64 = 14
)

MajorVersion is the current major version of the pool workflow protocol.

const MajorVersion uint64 = 3

MultisigProtocol identifies the embedded MultisigPool transaction protocol.

const MultisigProtocol = "bitfs.pool.v4"

MultisigVersion is the version of the embedded MultisigPool protocol.

const MultisigVersion uint64 = 4

ProtocolFamily is the go-bitfs pool workflow protocol. It is deliberately separate from the MultisigPool library protocol embedded in OpeningProof.

const ProtocolFamily = "bitfs.pool.workflow.v3"

Variables

var (
// ErrInvalidEvidence is returned when pool evidence fails structural or protocol validation.
ErrInvalidEvidence = errors.New("invalid pool evidence")
// ErrPoolBusy indicates that a pool already has an active delivery.
ErrPoolBusy = errors.New("pool busy")
// ErrStalePaymentSequence indicates that an update does not extend current state.
ErrStalePaymentSequence = errors.New("stale payment sequence")
// ErrInsufficientBalance indicates that a payment exceeds the pool balance.
ErrInsufficientBalance = errors.New("insufficient pool balance")
// ErrNonFinalRejected indicates that the node rejected a non-final payment update.
ErrNonFinalRejected = errors.New("non-final pool rejected update")
// ErrFinalRejected indicates that the node rejected a final transaction.
ErrFinalRejected = errors.New("pool node rejected final transaction")
// ErrNotExpired indicates that the refund locktime has not yet been reached.
ErrNotExpired = errors.New("pool refund expiry has not been reached")
// ErrPoolStateUncertain indicates that node acceptance must be reconciled
// after local persistence failed.
ErrPoolStateUncertain = errors.New("pool state requires external reconciliation")
)

func Build2of3LockingScript

func Build2of3LockingScript(pubkeys [][]byte) ([]byte, error)

Build2of3LockingScript delegates construction of the role-ordered 2-of-3 MultisigPool locking script. pubkeys must be exactly Buyer, Seller, Arbiter.

func BuildPoolLock

func BuildPoolLock(roles mp.ArbitratedPoolRoles) ([]byte, error)

BuildPoolLock is the public role-explicit lock adapter. The argument order is permanently Buyer, Seller, Arbiter through the v4 role object.

func EncodeFundingTxDelivery

func EncodeFundingTxDelivery(delivery *FundingTxDelivery) ([]byte, error)

EncodeFundingTxDelivery validates and encodes the 002 funding-transaction delivery container. It does not verify that the funding transaction spends the retained opening proof.

func EncodeOpeningProof

func EncodeOpeningProof(proof *OpeningProof) ([]byte, error)

EncodeOpeningProof validates and encodes the complete 002 opening proof, including refund/funding bytes, role keys, and pool parameters.

func EncodePaymentUpdate

func EncodePaymentUpdate(update *PaymentUpdate) ([]byte, error)

EncodePaymentUpdate validates and encodes the 005 unsigned transaction plus detached buyer signature as its four-field deterministic CBOR container. It performs structural validation, not node acceptance or signature verification.

func EncodeRefundPresignRequest

func EncodeRefundPresignRequest(request *RefundPresignRequest) ([]byte, error)

EncodeRefundPresignRequest validates and encodes the 002 buyer refund-presign request, including protocol versions, refund bytes, pool output, role keys, fee rate, and detached buyer signature.

func EncodeRefundPresignResponse

func EncodeRefundPresignResponse(response *RefundPresignResponse) ([]byte, error)

EncodeRefundPresignResponse validates and encodes the seller's 002 refund signature response with the fixed protocol and MultisigPool version fields.

func ValidateFundingTxDelivery

func ValidateFundingTxDelivery(delivery *FundingTxDelivery) error

ValidateFundingTxDelivery checks the 002 delivery version and requires raw funding transaction bytes; it does not prove the bytes spend the opening.

func ValidateOpeningProof

func ValidateOpeningProof(proof *OpeningProof) error

ValidateOpeningProof checks the 002 proof discriminators and required hashes, pool lock, role keys, refund signatures, and funding bytes. It is structural; VerifyOpening performs transaction and signature relationship checks.

func ValidatePaymentUpdate

func ValidatePaymentUpdate(update *PaymentUpdate) error

ValidatePaymentUpdate checks the 005 envelope version, 32-byte authorization hash, and presence of the unsigned transaction and detached buyer signature. It does not parse the transaction or establish that a node accepted it.

func ValidateRefundPresignRequest

func ValidateRefundPresignRequest(request *RefundPresignRequest) error

ValidateRefundPresignRequest checks the 002 request discriminators, required funding/refund evidence, role keys, fee rate, and buyer signature presence. It does not verify the refund transaction or either signature cryptographically.

func ValidateRefundPresignResponse

func ValidateRefundPresignResponse(response *RefundPresignResponse) error

ValidateRefundPresignResponse checks the 002 response version and requires a seller refund signature; matching it to a request is a workflow operation.

type ArbiterPoolAdapter

ArbiterPoolAdapter adapts the pool engine to arbiter workflow operations.

type ArbiterPoolAdapter struct {
*MultisigPoolEngine
Key PrivateKeyProvider
}

func NewArbiterPoolAdapter

func NewArbiterPoolAdapter(engine *MultisigPoolEngine, key PrivateKeyProvider) *ArbiterPoolAdapter

NewArbiterPoolAdapter binds an engine to the arbiter private-key provider used to sign the candidate state selected by the 007 workflow.

func (*ArbiterPoolAdapter) SignArbiterPayment

func (adapter *ArbiterPoolAdapter) SignArbiterPayment(ctx context.Context, unsigned *UnsignedPayment, _ Signer) ([]byte, error)

SignArbiterPayment produces the arbiter's detached signature over an unsigned pool transaction.

type BSVTransactionIDCalculator

BSVTransactionIDCalculator adapts the synchronous reference engine to the context-aware opening workflow port. Production applications can replace it with a database-backed calculator or a node/SDK implementation.

type BSVTransactionIDCalculator struct {
Engine *MultisigPoolEngine
}

func (BSVTransactionIDCalculator) TransactionID

func (calculator BSVTransactionIDCalculator) TransactionID(_ context.Context, rawTx []byte) (Hash32, error)

TransactionID computes the canonical transaction identifier from raw transaction bytes.

type BuyerOpeningPort

BuyerOpeningPort adapts application stores, signature verification, and transaction-ID calculation to the buyer-side 002 opening workflow.

type BuyerOpeningPort struct {
Store OpeningProofStore
Verifier RefundTxSignatureVerifier
Calculator TransactionIDCalculator
}

func (BuyerOpeningPort) LoadOpeningProof

func (port BuyerOpeningPort) LoadOpeningProof(ctx context.Context, spendTxID Hash32) (*OpeningProof, error)

LoadOpeningProof loads the opening proof keyed by spend transaction ID.

func (BuyerOpeningPort) SaveOpeningProof

func (port BuyerOpeningPort) SaveOpeningProof(ctx context.Context, proof *OpeningProof) error

SaveOpeningProof validates and persists the opening proof keyed by its spend transaction ID.

func (BuyerOpeningPort) TransactionID

func (port BuyerOpeningPort) TransactionID(ctx context.Context, rawTx []byte) (Hash32, error)

TransactionID computes the canonical transaction identifier from raw transaction bytes.

func (BuyerOpeningPort) VerifySellerRefundSignature

func (port BuyerOpeningPort) VerifySellerRefundSignature(ctx context.Context, request *RefundPresignRequest, signature []byte) error

VerifySellerRefundSignature checks the seller's detached signature against the buyer-signed 002 refund-presign request. The verifier also reconstructs the unsigned refund state and confirms both buyer and seller role signatures before the buyer records an OpeningProof.

type BuyerPoolAdapter

BuyerPoolAdapter adapts the pool engine to buyer workflow operations.

type BuyerPoolAdapter struct {
*MultisigPoolEngine
Key PrivateKeyProvider
}

func NewBuyerPoolAdapter

func NewBuyerPoolAdapter(engine *MultisigPoolEngine, key PrivateKeyProvider) *BuyerPoolAdapter

NewBuyerPoolAdapter binds an engine to the buyer private-key provider used for detached payment and refund signatures. It performs no signing at construction.

func (*BuyerPoolAdapter) BuildRefundPresignRequest

func (adapter *BuyerPoolAdapter) BuildRefundPresignRequest(ctx context.Context, input OpeningInput, _ Signer) (*RefundPresignRequest, error)

BuildRefundPresignRequest constructs a RefundPresignRequest from the funding transaction, opening input, and buyer's private key. Returns an error if the funding output does not use the configured pool lock or if the buyer key does not match the engine.

func (*BuyerPoolAdapter) SignBuyerPayment

func (adapter *BuyerPoolAdapter) SignBuyerPayment(ctx context.Context, unsigned *UnsignedPayment, _ Signer) ([]byte, error)

SignBuyerPayment produces the buyer's detached signature over an unsigned pool transaction.

type BuyerPoolOpeningHooks

BuyerPoolOpeningHooks supplies persistence and verification capabilities for buyer-side pool opening.

type BuyerPoolOpeningHooks interface {
OpeningProofStore
RefundTxSignatureVerifier
TransactionIDCalculator
}

type BuyerPoolPort

BuyerPoolPort exposes buyer-side pool construction, signing, and payment validation operations.

type BuyerPoolPort interface {
TransactionID([]byte) (Hash32, error)
BuildRefundPresignRequest(context.Context, OpeningInput, Signer) (*RefundPresignRequest, error)
BuildRefundSubmission(*OpeningProof) ([]byte, error)
VerifyRefundExpired(*OpeningProof, time.Time) error
VerifyOpening(*OpeningProof) error
ParsePaymentState(context.Context, []byte, *OpeningProof) (*PaymentState, error)
ParseUnsignedPayment(context.Context, []byte, *OpeningProof) (*UnsignedPayment, error)
VerifyAcceptedPayment(*PaymentState, *OpeningProof) error
VerifyBuyerPayment(*UnsignedPayment, []byte, *OpeningProof) error
VerifyCompletedFinalPayment(*SignedPayment, *OpeningProof) error
CheckPaymentCapacity(context.Context, PaymentUpdateInput) error
BuildPaymentUpdate(context.Context, PaymentUpdateInput) (*UnsignedPayment, error)
SignBuyerPayment(context.Context, *UnsignedPayment, Signer) ([]byte, error)
BuildImmediateClose(context.Context, CloseInput) (*UnsignedPayment, []byte, error)
}

type CloseInput

CloseInput supplies the signatures and transaction data required for an immediate close.

type CloseInput struct {
Opening *OpeningProof
Latest *PaymentState
SellerAmountAfterSat uint64
}

func CloneCloseInput

func CloneCloseInput(input CloseInput) CloseInput

CloneCloseInput returns an independent copy of CloseInput, including copies of mutable byte slices.

type FileStore

FileStore is a small durable reference implementation of the pool storage ports. It uses an advisory process lock and reloads the current snapshot for every operation, so cooperating Unix processes do not overwrite each other's updates. A transactional database is still preferable when the deployment needs indexed queries, crash-recovery guarantees beyond atomic rename, or an authoritative lock service.

Each mutation writes a complete snapshot through a temporary file and an atomic rename. Raw transactions, signatures and pending price commitments therefore survive a process restart without changing their protocol bytes.

type FileStore struct {
// contains filtered or unexported fields
}

func NewFileStore

func NewFileStore(path string, calculator TransactionIDCalculator) (*FileStore, error)

NewFileStore opens path and rehydrates all pool, payment and delivery-latch state. A missing file is treated as an empty store.

func (*FileStore) EnsurePoolHealthy

func (store *FileStore) EnsurePoolHealthy(ctx context.Context, spendTxID Hash32) error

EnsurePoolHealthy rejects operations after an uncertain external submission is recorded.

func (*FileStore) Load

func (store *FileStore) Load(ctx context.Context, spendTxID Hash32) (*PendingRequest, error)

Load returns the pending delivery request for spendTxID from the latest disk snapshot.

func (*FileStore) LoadAcceptedPayment

func (store *FileStore) LoadAcceptedPayment(ctx context.Context, spendTxID Hash32) (*PaymentState, error)

LoadAcceptedPayment returns the accepted payment state for a spend transaction ID.

func (*FileStore) LoadOpeningProof

func (store *FileStore) LoadOpeningProof(ctx context.Context, spendTxID Hash32) (*OpeningProof, error)

LoadOpeningProof loads the opening proof keyed by spend transaction ID.

func (*FileStore) LoadOpeningProofByFundingTxID

func (store *FileStore) LoadOpeningProofByFundingTxID(ctx context.Context, fundingTxID Hash32) (*OpeningProof, error)

LoadOpeningProofByFundingTxID finds an opening proof by its funding transaction ID.

func (*FileStore) MarkExternalStateUncertain

func (store *FileStore) MarkExternalStateUncertain(ctx context.Context, spendTxID, txID Hash32) error

MarkExternalStateUncertain records a transaction ID whose node outcome must be reconciled.

func (*FileStore) ReconcileExternalState

func (store *FileStore) ReconcileExternalState(ctx context.Context, spendTxID Hash32, state *PaymentState) error

ReconcileExternalState clears uncertainty after the caller supplies the accepted payment state.

func (*FileStore) Release

func (store *FileStore) Release(ctx context.Context, spendTxID, requestHash Hash32) error

Release removes a pending request lease only when the caller supplies the matching request hash.

func (*FileStore) SaveAcceptedPayment

func (store *FileStore) SaveAcceptedPayment(ctx context.Context, state *PaymentState) error

SaveAcceptedPayment stores a payment by spend transaction ID and rejects sequence rollback or conflicting same-sequence state.

func (*FileStore) SaveOpeningProof

func (store *FileStore) SaveOpeningProof(ctx context.Context, proof *OpeningProof) error

SaveOpeningProof validates and persists the opening proof keyed by its spend transaction ID.

func (*FileStore) TryAcquire

func (store *FileStore) TryAcquire(ctx context.Context, request PendingRequest) (PendingAcquireResult, error)

TryAcquire atomically claims a pending request lease unless another owner or hash conflict exists.

type FundingTxDelivery

FundingTxDelivery carries the buyer-signed funding transaction revealed after refund verification.

type FundingTxDelivery struct {
Version uint64
FundingTx []byte
}

func CloneFundingTxDelivery

func CloneFundingTxDelivery(delivery *FundingTxDelivery) *FundingTxDelivery

CloneFundingTxDelivery returns an independent copy of FundingTxDelivery, including copies of mutable byte slices.

func DecodeFundingTxDelivery

func DecodeFundingTxDelivery(data []byte) (*FundingTxDelivery, error)

DecodeFundingTxDelivery decodes and canonicality-checks the 002 funding delivery; SellerAcceptFundingTx performs the proof and node checks.

type FundingTxVerifier

FundingTxVerifier validates that a raw funding transaction matches its opening proof.

type FundingTxVerifier interface {
VerifyFundingTx(context.Context, []byte, *OpeningProof) error
}

type Hash32

Hash32 stores a fixed-width 32-byte hash used for protocol identities and transaction IDs.

type Hash32 [sha256.Size]byte

func SpendTxID

func SpendTxID(ctx context.Context, proof *OpeningProof, calculator TransactionIDCalculator) (Hash32, error)

SpendTxID is the stable transaction anchor defined by 002: the canonical ID of the presigned RefundTx evidence bytes. BuildRefundSubmission later adds the separate signatures for actual broadcast, which may produce another transaction ID because unlocking data is part of the txid.

type MemoryStore

MemoryStore is a concurrency-safe reference implementation of the pool persistence ports. It is useful for integration tests and small embedded deployments; replacing it does not change protocol semantics.

type MemoryStore struct {
// contains filtered or unexported fields
}

func NewMemoryStore

func NewMemoryStore(calculator TransactionIDCalculator) (*MemoryStore, error)

NewMemoryStore requires a non-nil transaction ID calculator and returns an empty concurrency-safe store for opening proofs, payments, health markers, and pending delivery leases.

func (*MemoryStore) EnsurePoolHealthy

func (store *MemoryStore) EnsurePoolHealthy(_ context.Context, spendTxID Hash32) error

EnsurePoolHealthy rejects operations after an uncertain external submission is recorded.

func (*MemoryStore) Load

func (store *MemoryStore) Load(_ context.Context, spendTxID Hash32) (*PendingRequest, error)

Load returns a copy of the pending delivery request for spendTxID.

func (*MemoryStore) LoadAcceptedPayment

func (store *MemoryStore) LoadAcceptedPayment(_ context.Context, spendTxID Hash32) (*PaymentState, error)

LoadAcceptedPayment returns the accepted payment state for a spend transaction ID.

func (*MemoryStore) LoadOpeningProof

func (store *MemoryStore) LoadOpeningProof(_ context.Context, spendTxID Hash32) (*OpeningProof, error)

LoadOpeningProof loads the opening proof keyed by spend transaction ID.

func (*MemoryStore) LoadOpeningProofByFundingTxID

func (store *MemoryStore) LoadOpeningProofByFundingTxID(_ context.Context, fundingTxID Hash32) (*OpeningProof, error)

LoadOpeningProofByFundingTxID finds an opening proof by its funding transaction ID.

func (*MemoryStore) MarkExternalStateUncertain

func (store *MemoryStore) MarkExternalStateUncertain(_ context.Context, spendTxID, txID Hash32) error

MarkExternalStateUncertain records a transaction ID whose node outcome must be reconciled.

func (*MemoryStore) ReconcileExternalState

func (store *MemoryStore) ReconcileExternalState(ctx context.Context, spendTxID Hash32, state *PaymentState) error

ReconcileExternalState clears uncertainty after the caller supplies the accepted payment state.

func (*MemoryStore) Release

func (store *MemoryStore) Release(_ context.Context, spendTxID, requestHash Hash32) error

Release removes a pending request lease only when the caller supplies the matching request hash.

func (*MemoryStore) SaveAcceptedPayment

func (store *MemoryStore) SaveAcceptedPayment(_ context.Context, state *PaymentState) error

SaveAcceptedPayment stores state by SpendTxID. It rejects lower payment sequences and conflicting bytes at the same sequence, preserving monotonic accepted state for retries.

func (*MemoryStore) SaveOpeningProof

func (store *MemoryStore) SaveOpeningProof(ctx context.Context, proof *OpeningProof) error

SaveOpeningProof validates and persists the opening proof keyed by its spend transaction ID.

func (*MemoryStore) TryAcquire

func (store *MemoryStore) TryAcquire(_ context.Context, request PendingRequest) (PendingAcquireResult, error)

TryAcquire atomically claims a pending request lease unless another owner or hash conflict exists.

type MultisigPoolAdapter

MultisigPoolAdapter is the arbiter-facing capability. It contains no legacy role aliases and never constructs a replacement candidate transaction.

type MultisigPoolAdapter struct {
Engine *MultisigPoolEngine
ArbiterKey PrivateKeyProvider
}

func (*MultisigPoolAdapter) SignArbitrationCandidate

func (adapter *MultisigPoolAdapter) SignArbitrationCandidate(ctx context.Context, raw []byte, proof *OpeningProof, _ Signer) ([]byte, error)

SignArbitrationCandidate signs the role-specific transaction or authorization bytes with the injected signer.

func (*MultisigPoolAdapter) VerifyArbitrationCandidate

func (adapter *MultisigPoolAdapter) VerifyArbitrationCandidate(_ context.Context, raw []byte, proof *OpeningProof, terms *bitfs.ContentRequestTerms, sellerSig []byte) (*UnsignedPayment, error)

VerifyArbitrationCandidate validates the seller's 007 candidate against the standalone 003 authorization. It checks the opening proof, fee rate and next sequence, matches seller amount and sequence in the unsigned transaction, and verifies the seller's detached signature without constructing a replacement.

func (*MultisigPoolAdapter) VerifyOpening

func (adapter *MultisigPoolAdapter) VerifyOpening(proof *OpeningProof) error

VerifyOpening validates the complete 002 OpeningProof through MultisigPool v4: role keys, funding output, unsigned refund state, and buyer/seller refund signatures must all agree before a workflow may accept the pool.

type MultisigPoolEngine

MultisigPoolEngine is the adapter boundary to MultisigPool v4. It preserves Buyer/Seller/Arbiter role ordering while delegating scripts, fees, sighash, state construction, and signature ordering to that dependency.

type MultisigPoolEngine struct {
// contains filtered or unexported fields
}

func NewMultisigPoolEngine

func NewMultisigPoolEngine(config MultisigPoolEngineConfig) (*MultisigPoolEngine, error)

NewMultisigPoolEngine parses and validates three distinct role keys, preserving Buyer/Seller/Arbiter identity for every later transaction check. It returns an error for malformed or duplicate keys and performs no network or storage I/O.

func (*MultisigPoolEngine) BuildImmediateClose

func (engine *MultisigPoolEngine) BuildImmediateClose(_ context.Context, input CloseInput) (*UnsignedPayment, []byte, error)

BuildImmediateClose constructs the unsigned final close state and buyer detached signature from the accepted payment and CloseInput. The seller adds its signature with SignImmediateClose before the buyer submits the merged SignedPayment through its workflow.

func (*MultisigPoolEngine) BuildPaymentUpdate

func (engine *MultisigPoolEngine) BuildPaymentUpdate(ctx context.Context, input PaymentUpdateInput) (*UnsignedPayment, error)

BuildPaymentUpdate constructs the next unsigned pool state transaction from the previous accepted payment and the requested amounts.

func (*MultisigPoolEngine) BuildRefundSubmission

func (engine *MultisigPoolEngine) BuildRefundSubmission(proof *OpeningProof) ([]byte, error)

BuildRefundSubmission merges the buyer and seller refund signatures from the opening proof into a broadcast-ready transaction.

func (*MultisigPoolEngine) CheckPaymentCapacity

func (engine *MultisigPoolEngine) CheckPaymentCapacity(_ context.Context, input PaymentUpdateInput) error

CheckPaymentCapacity validates that the requested payment update does not exceed the pool balance and uses a strictly increasing sequence number.

func (*MultisigPoolEngine) FundingTxID

func (engine *MultisigPoolEngine) FundingTxID(rawTx []byte) (Hash32, error)

FundingTxID returns the 32-byte funding outpoint from the first input of a raw transaction.

func (*MultisigPoolEngine) ParseFinalPaymentState

func (engine *MultisigPoolEngine) ParseFinalPaymentState(ctx context.Context, rawTx []byte, proof *OpeningProof) (*PaymentState, error)

ParseFinalPaymentState parses a fully signed pool transaction and verifies it is the final settlement (sequence == finalPoolSequence).

func (*MultisigPoolEngine) ParsePaymentState

func (engine *MultisigPoolEngine) ParsePaymentState(_ context.Context, rawTx []byte, proof *OpeningProof) (*PaymentState, error)

ParsePaymentState parses a fully signed pool transaction into a PaymentState. Returns an error if the transaction has an empty unlocking script.

func (*MultisigPoolEngine) ParseUnsignedPayment

func (engine *MultisigPoolEngine) ParseUnsignedPayment(_ context.Context, rawTx []byte, proof *OpeningProof) (*UnsignedPayment, error)

ParseUnsignedPayment validates and parses an unsigned pool transaction against the opening proof's canonical state.

func (*MultisigPoolEngine) TransactionID

func (engine *MultisigPoolEngine) TransactionID(rawTx []byte) (Hash32, error)

TransactionID computes the canonical transaction identifier from raw transaction bytes.

func (*MultisigPoolEngine) VerifyAcceptedPayment

func (engine *MultisigPoolEngine) VerifyAcceptedPayment(state *PaymentState, proof *OpeningProof) error

VerifyAcceptedPayment checks the initial or previously accepted non-arbitrated payment state against the opening proof and its complete role signatures.

func (*MultisigPoolEngine) VerifyArbitratedPayment

func (engine *MultisigPoolEngine) VerifyArbitratedPayment(state *PaymentState, proof *OpeningProof) error

VerifyArbitratedPayment checks a final state carrying the seller and arbiter signatures required by the 007 arbitration path.

func (*MultisigPoolEngine) VerifyBuyerPayment

func (engine *MultisigPoolEngine) VerifyBuyerPayment(unsigned *UnsignedPayment, sig []byte, proof *OpeningProof) error

VerifyBuyerPayment checks the buyer role's detached signature over the exact unsigned 005 payment state and its canonical relation to the 002 opening proof. It does not merge signatures or submit the update.

func (*MultisigPoolEngine) VerifyCompletedFinalPayment

func (engine *MultisigPoolEngine) VerifyCompletedFinalPayment(payment *SignedPayment, proof *OpeningProof) error

VerifyCompletedFinalPayment validates the merged SignedPayment and identifies whether its detached signatures form a valid final settlement state.

func (*MultisigPoolEngine) VerifyFinalPayment

func (engine *MultisigPoolEngine) VerifyFinalPayment(state *PaymentState, proof *OpeningProof) error

VerifyFinalPayment checks a fully signed final transaction against the opening proof, final sequence, role signatures, outputs, and canonical transaction bytes.

func (*MultisigPoolEngine) VerifyFundingTx

func (engine *MultisigPoolEngine) VerifyFundingTx(_ context.Context, rawTx []byte, proof *OpeningProof) error

VerifyFundingTx parses the delivered 002 funding transaction and matches its txid, pool output index, satoshis, and role-ordered MultisigPool v4 locking script to proof. It is an evidence check only and does not submit the transaction.

func (*MultisigPoolEngine) VerifyOpening

func (engine *MultisigPoolEngine) VerifyOpening(proof *OpeningProof) error

VerifyOpening validates a complete 002 OpeningProof against this engine's Buyer/Seller/Arbiter roles. It matches the proof to the funding output and unsigned refund state, then verifies the buyer and seller refund signatures; it performs no persistence or node submission.

func (*MultisigPoolEngine) VerifyPoolParticipants

func (engine *MultisigPoolEngine) VerifyPoolParticipants(proof *OpeningProof, buyer, seller, arbiter []byte) error

VerifyPoolParticipants checks that the opening proof's buyer, seller, and arbiter keys match the supplied values.

func (*MultisigPoolEngine) VerifyRefundExpired

func (engine *MultisigPoolEngine) VerifyRefundExpired(proof *OpeningProof, now time.Time) error

VerifyRefundExpired checks whether the refund transaction's nLockTime has been reached. For block-height refunds it requires a BlockHeight provider; for timestamp refunds it compares against now.

func (*MultisigPoolEngine) VerifySellerPayment

func (engine *MultisigPoolEngine) VerifySellerPayment(unsigned *UnsignedPayment, sig []byte, proof *OpeningProof) error

VerifySellerPayment checks the seller role's detached signature over the exact unsigned 005 payment state and its canonical relation to the 002 opening proof. It does not merge signatures or submit the update.

func (*MultisigPoolEngine) VerifySellerRefundSignature

func (engine *MultisigPoolEngine) VerifySellerRefundSignature(_ context.Context, request *RefundPresignRequest, signature []byte) error

VerifySellerRefundSignature validates the 002 presigned refund state named by request, including its funding outpoint, role keys, buyer signature, and the supplied seller detached signature. It does not submit either transaction.

type MultisigPoolEngineConfig

MultisigPoolEngineConfig supplies compressed Buyer, Seller, and Arbiter public keys in role order. BlockHeight is optional and is used only for block-height refund expiry checks; fee and transaction rules come from MultisigPool v4.

type MultisigPoolEngineConfig struct {
BuyerPubKey []byte
SellerPubKey []byte
ArbiterPubKey []byte
BlockHeight func() uint32
}

type NonFinalPoolBackend

NonFinalPoolBackend is the narrow boundary for a concrete BSV node/RPC client. SubmitUpdate must return only after the node has accepted rawTx as the current non-final spend; SubmitFinal must return only after final acceptance. A JSON-RPC, gRPC or vendor SDK client can implement this port without being coupled to seller or buyer workflow code.

type NonFinalPoolBackend interface {
SubmitUpdate(context.Context, []byte) (*UpdateAcceptance, error)
SubmitFinal(context.Context, []byte) (Hash32, error)
}

type NonFinalPoolNode

NonFinalPoolNode submits verified cumulative updates and final settlement transactions to a node.

type NonFinalPoolNode interface {
SubmitUpdate(context.Context, []byte) (*UpdateAcceptance, error)
SubmitFinal(context.Context, []byte) (Hash32, error)
}

type OpeningByFundingStore

OpeningByFundingStore supplies the opening proof needed to verify a raw payment before it reaches a node adapter.

type OpeningByFundingStore interface {
LoadOpeningProofByFundingTxID(context.Context, Hash32) (*OpeningProof, error)
}

type OpeningInput

OpeningInput contains generic pool construction data only.

type OpeningInput struct {
FundingTx []byte
PoolOutputIndex uint32
ExpiryLockTime uint32
MinerFeeRateSatPerKB uint64
SellerPubKey []byte
ArbiterPubKey []byte
}

func CloneOpeningInput

func CloneOpeningInput(input OpeningInput) OpeningInput

CloneOpeningInput returns an independent copy of OpeningInput, including copies of mutable byte slices.

type OpeningProof

OpeningProof records the mutually verified refund and funding transactions that open a pool.

type OpeningProof struct {
Version uint64
MultisigProtocol string
MultisigVersion uint64
RefundTx []byte
SpendTxID []byte
FundingTxID []byte
PoolOutputIndex uint32
PoolOutputSatoshis uint64
PoolLockingScript []byte
BuyerPubKey []byte
SellerPubKey []byte
ArbiterPubKey []byte
MinerFeeRateSatPerKB uint64
BuyerRefundSignature []byte
SellerRefundSignature []byte
FundingTx []byte
}

func BuyerAcceptRefundPresign

func BuyerAcceptRefundPresign(ctx context.Context, request *RefundPresignRequest, response *RefundPresignResponse, fundingTx []byte, hooks BuyerPoolOpeningHooks) (*OpeningProof, error)

BuyerAcceptRefundPresign verifies and persists the complete proof before the caller is allowed to reveal FundingTx to the seller.

func CloneOpeningProof

func CloneOpeningProof(proof *OpeningProof) *OpeningProof

CloneOpeningProof returns an independent copy of OpeningProof, including copies of mutable byte slices.

func DecodeOpeningProof

func DecodeOpeningProof(data []byte) (*OpeningProof, error)

DecodeOpeningProof decodes and canonicality-checks a 002 opening proof, then performs field validation; VerifyOpening is still required for signatures and transaction relationships.

func SellerAcceptFundingTx

func SellerAcceptFundingTx(ctx context.Context, delivery *FundingTxDelivery, hooks SellerPoolOpeningHooks) (*OpeningProof, error)

SellerAcceptFundingTx verifies the funding transaction against the retained refund proof, persists it, then submits it. A submit retry is safe when the node treats transaction IDs idempotently.

type OpeningProofStore

OpeningProofStore persists and retrieves the verified 002 opening proof keyed by SpendTxID, the canonical ID of the presigned refund evidence.

type OpeningProofStore interface {
SaveOpeningProof(context.Context, *OpeningProof) error
LoadOpeningProof(context.Context, Hash32) (*OpeningProof, error)
}

type ParticipantVerifier

ParticipantVerifier checks that an opening proof's buyer, seller, and arbiter keys match the expected values.

type ParticipantVerifier interface {
VerifyPoolParticipants(*OpeningProof, []byte, []byte, []byte) error
}

type PaymentState

PaymentState only represents a fully merged transaction accepted by a node. Detached signatures are kept explicitly when a workflow needs to carry them across an API boundary, but RawTx is never a single-signature or unsigned transaction.

type PaymentState struct {
SpendTxID Hash32
RawTx []byte
PaymentSequence uint32
BuyerAmountSat uint64
SellerAmountSat uint64
ArbiterAmountSat uint64
PaymentAuthorizationHash Hash32
BuyerTransactionSignature []byte
SellerTransactionSignature []byte
ArbiterTransactionSignature []byte
PoolOutputSatoshis uint64
PoolLockingScript []byte
}

func ClonePaymentState

func ClonePaymentState(state *PaymentState) *PaymentState

ClonePaymentState returns an independent copy of PaymentState, including copies of mutable byte slices.

type PaymentUpdate

PaymentUpdate is the v3 005 transport container. It carries an unsigned state transaction and a detached Buyer signature; it never carries a partially unlocked transaction.

type PaymentUpdate struct {
Version uint64
PaymentAuthorizationHash []byte
UnsignedStateTxRaw []byte
BuyerTransactionSignature []byte
}

func ClonePaymentUpdate

func ClonePaymentUpdate(update *PaymentUpdate) *PaymentUpdate

ClonePaymentUpdate returns an independent copy of PaymentUpdate, including copies of mutable byte slices.

func DecodePaymentUpdate

func DecodePaymentUpdate(data []byte) (*PaymentUpdate, error)

DecodePaymentUpdate decodes and canonicality-checks the 005 four-field payment container, then validates its field shape. It does not prove pool ownership or verify the buyer signature against an opening proof.

type PaymentUpdateInput

PaymentUpdateInput supplies the next cumulative payment state and its transaction bytes.

type PaymentUpdateInput struct {
Opening *OpeningProof
Previous *PaymentState
PaymentSequenceAfter uint32
SellerAmountAfterSat uint64
}

func ClonePaymentUpdateInput

func ClonePaymentUpdateInput(input PaymentUpdateInput) PaymentUpdateInput

ClonePaymentUpdateInput returns an independent copy of PaymentUpdateInput, including copies of mutable byte slices.

type PendingAcquireResult

PendingAcquireResult reports whether a delivery lease was acquired, held, or conflicted.

type PendingAcquireResult uint8
const (
// PendingAcquired indicates the delivery lease was successfully acquired.
PendingAcquired PendingAcquireResult = 1
// PendingAlreadyHeld indicates that another request currently owns the lock.
PendingAlreadyHeld PendingAcquireResult = 2
// PendingConflict indicates that the request hash conflicts with the owner.
PendingConflict PendingAcquireResult = 3
)

type PendingOpeningProofStore

PendingOpeningProofStore persists an opening proof before funding is accepted and retrieves it by the revealed funding transaction ID.

type PendingOpeningProofStore interface {
SaveOpeningProof(context.Context, *OpeningProof) error
LoadOpeningProofByFundingTxID(context.Context, Hash32) (*OpeningProof, error)
}

type PendingRequest

PendingRequest records the request hash and ownership lease used to serialize delivery.

type PendingRequest struct {
SpendTxID Hash32
BasePaymentSequence uint32
ContentRequestHash Hash32
ExpectedSellerAmountSat uint64
}

type PendingRequestStore

PendingRequestStore manages content-request delivery leases keyed by spend transaction ID.

type PendingRequestStore interface {
TryAcquire(context.Context, PendingRequest) (PendingAcquireResult, error)
Load(context.Context, Hash32) (*PendingRequest, error)
Release(context.Context, Hash32, Hash32) error
}

type PoolNodeVerifierPort

PoolNodeVerifierPort verifies pool transactions before they reach a concrete node adapter.

type PoolNodeVerifierPort interface {
FundingTxID([]byte) (Hash32, error)
TransactionID([]byte) (Hash32, error)
BuildRefundSubmission(*OpeningProof) ([]byte, error)
VerifyRefundExpired(*OpeningProof, time.Time) error
ParsePaymentState(context.Context, []byte, *OpeningProof) (*PaymentState, error)
ParseUnsignedPayment(context.Context, []byte, *OpeningProof) (*UnsignedPayment, error)
ParseFinalPaymentState(context.Context, []byte, *OpeningProof) (*PaymentState, error)
VerifyAcceptedPayment(*PaymentState, *OpeningProof) error
VerifyArbitratedPayment(*PaymentState, *OpeningProof) error
VerifyCompletedFinalPayment(*SignedPayment, *OpeningProof) error
}

type PoolRefundSigner

PoolRefundSigner adapts a SellerPoolAdapter to the RefundTxSigner interface.

type PoolRefundSigner struct{ Adapter *SellerPoolAdapter }

func (PoolRefundSigner) SignRefundTx

func (adapter PoolRefundSigner) SignRefundTx(ctx context.Context, request *RefundPresignRequest) ([]byte, error)

SignRefundTx produces the seller's detached signature over the presigned refund transaction described by request.

type PoolStore

PoolStore combines opening-proof and accepted-payment persistence with health reconciliation and the seller delivery lease used by the role workflows.

type PoolStore interface {
OpeningProofStore
LoadOpeningProofByFundingTxID(context.Context, Hash32) (*OpeningProof, error)
SaveAcceptedPayment(context.Context, *PaymentState) error
LoadAcceptedPayment(context.Context, Hash32) (*PaymentState, error)
EnsurePoolHealthy(context.Context, Hash32) error
MarkExternalStateUncertain(context.Context, Hash32, Hash32) error
ReconcileExternalState(context.Context, Hash32, *PaymentState) error
}

type PrivateKeyProvider

PrivateKeyProvider is intentionally narrower than the workflow Signer: MultisigPool must receive the actual private key so it can calculate its canonical sighash and detached signature.

type PrivateKeyProvider interface {
PrivateKey(context.Context) (*ec.PrivateKey, error)
}

type Reference

Reference identifies the settlement pool and payment sequence used by a content request.

type Reference struct {
SpendTxID Hash32
BasePaymentSequence uint32
}

type RefundPresignRequest

RefundPresignRequest contains the buyer-seller terms for a presigned refund transaction.

type RefundPresignRequest struct {
Version uint64
MultisigProtocol string
MultisigVersion uint64
RefundTx []byte
FundingTxID []byte
PoolOutputIndex uint32
PoolOutputSatoshis uint64
PoolLockingScript []byte
BuyerPubKey []byte
SellerPubKey []byte
ArbiterPubKey []byte
MinerFeeRateSatPerKB uint64
BuyerRefundSignature []byte
}

func CloneRefundPresignRequest

func CloneRefundPresignRequest(request *RefundPresignRequest) *RefundPresignRequest

CloneRefundPresignRequest returns an independent copy of RefundPresignRequest, including copies of mutable byte slices.

func DecodeRefundPresignRequest

func DecodeRefundPresignRequest(data []byte) (*RefundPresignRequest, error)

DecodeRefundPresignRequest decodes and canonicality-checks the 002 request; cryptographic and funding-transaction acceptance remains the opening workflow's job.

type RefundPresignResponse

RefundPresignResponse carries the seller signature over the presigned refund transaction.

type RefundPresignResponse struct {
Version uint64
SellerRefundSignature []byte
}

func CloneRefundPresignResponse

func CloneRefundPresignResponse(response *RefundPresignResponse) *RefundPresignResponse

CloneRefundPresignResponse returns an independent copy of RefundPresignResponse, including copies of mutable byte slices.

func DecodeRefundPresignResponse

func DecodeRefundPresignResponse(data []byte) (*RefundPresignResponse, error)

DecodeRefundPresignResponse decodes and canonicality-checks the 002 seller response without deciding whether the signature matches a particular request.

func SellerPresignRefund

func SellerPresignRefund(ctx context.Context, request *RefundPresignRequest, hooks SellerPoolOpeningHooks) (*RefundPresignResponse, error)

SellerPresignRefund signs and durably records the refund evidence before returning. FundingTx is intentionally not required at this stage.

type RefundTxSignatureVerifier

RefundTxSignatureVerifier validates the seller's detached refund signature against the presign request.

type RefundTxSignatureVerifier interface {
VerifySellerRefundSignature(context.Context, *RefundPresignRequest, []byte) error
}

type RefundTxSigner

RefundTxSigner produces the seller's detached signature over a presigned refund transaction.

type RefundTxSigner interface {
SignRefundTx(context.Context, *RefundPresignRequest) ([]byte, error)
}

type SellerOpeningPort

SellerOpeningPort adapts seller-side 002 opening capabilities. Funding submission remains separate from non-final payment replacement because they are distinct external state transitions.

type SellerOpeningPort struct {
Store PendingOpeningProofStore
RefundSigner RefundTxSigner
Calculator TransactionIDCalculator
FundingVerifier FundingTxVerifier
FundingSubmitter TransactionSubmitter
}

func (SellerOpeningPort) LoadOpeningProofByFundingTxID

func (port SellerOpeningPort) LoadOpeningProofByFundingTxID(ctx context.Context, fundingTxID Hash32) (*OpeningProof, error)

LoadOpeningProofByFundingTxID finds an opening proof by its funding transaction ID.

func (SellerOpeningPort) SaveOpeningProof

func (port SellerOpeningPort) SaveOpeningProof(ctx context.Context, proof *OpeningProof) error

SaveOpeningProof validates and persists the opening proof keyed by its spend transaction ID.

func (SellerOpeningPort) SignRefundTx

func (port SellerOpeningPort) SignRefundTx(ctx context.Context, request *RefundPresignRequest) ([]byte, error)

SignRefundTx signs the role-specific transaction or authorization bytes with the injected signer.

func (SellerOpeningPort) SubmitTransaction

func (port SellerOpeningPort) SubmitTransaction(ctx context.Context, rawTx []byte) (Hash32, error)

SubmitTransaction submits the verified transaction through the configured node or submitter.

func (SellerOpeningPort) TransactionID

func (port SellerOpeningPort) TransactionID(ctx context.Context, rawTx []byte) (Hash32, error)

TransactionID computes the canonical transaction identifier from raw transaction bytes.

func (SellerOpeningPort) VerifyFundingTx

func (port SellerOpeningPort) VerifyFundingTx(ctx context.Context, fundingTx []byte, proof *OpeningProof) error

VerifyFundingTx delegates 002 funding acceptance to the configured verifier. It checks that the delivered raw funding transaction has the proof's outpoint, amount, and role-ordered pool lock; submission is performed separately.

type SellerPoolAdapter

SellerPoolAdapter adapts the pool engine to seller workflow operations.

type SellerPoolAdapter struct {
*MultisigPoolEngine
Key PrivateKeyProvider
}

func NewSellerPoolAdapter

func NewSellerPoolAdapter(engine *MultisigPoolEngine, key PrivateKeyProvider) *SellerPoolAdapter

NewSellerPoolAdapter binds an engine to the seller private-key provider used for detached payment, refund, and arbitration-candidate signatures.

func (*SellerPoolAdapter) MergeBuyerSellerPayment

func (adapter *SellerPoolAdapter) MergeBuyerSellerPayment(unsigned *UnsignedPayment, buyerSig, sellerSig []byte) (*SignedPayment, error)

MergeBuyerSellerPayment combines detached role signatures into the required fully signed payment transaction.

func (*SellerPoolAdapter) MergeSellerArbiterPayment

func (adapter *SellerPoolAdapter) MergeSellerArbiterPayment(unsigned *UnsignedPayment, sellerSig, arbiterSig []byte) (*SignedPayment, error)

MergeSellerArbiterPayment combines detached role signatures into the required fully signed payment transaction.

func (*SellerPoolAdapter) SignImmediateClose

func (adapter *SellerPoolAdapter) SignImmediateClose(ctx context.Context, unsigned *UnsignedPayment, buyerSig []byte, _ Signer) (*SignedPayment, error)

SignImmediateClose signs the seller's portion of an immediate close and merges it with the buyer signature, returning the completed SignedPayment.

func (*SellerPoolAdapter) SignSellerArbitrationCandidate

func (adapter *SellerPoolAdapter) SignSellerArbitrationCandidate(ctx context.Context, unsigned *UnsignedPayment, _ Signer) ([]byte, error)

SignSellerArbitrationCandidate produces the seller's detached signature over an arbitration candidate transaction.

func (*SellerPoolAdapter) SignSellerPayment

func (adapter *SellerPoolAdapter) SignSellerPayment(ctx context.Context, unsigned *UnsignedPayment, _ Signer) ([]byte, error)

SignSellerPayment produces the seller's detached signature over an unsigned pool transaction.

func (*SellerPoolAdapter) VerifyBuyerPayment

func (adapter *SellerPoolAdapter) VerifyBuyerPayment(unsigned *UnsignedPayment, sig []byte, proof *OpeningProof) error

VerifyBuyerPayment checks the buyer role's detached signature over the exact unsigned 005 payment state, after validating its canonical outputs against the 002 opening proof. It does not merge the seller signature or submit the state.

func (*SellerPoolAdapter) VerifySellerPayment

func (adapter *SellerPoolAdapter) VerifySellerPayment(unsigned *UnsignedPayment, sig []byte, proof *OpeningProof) error

VerifySellerPayment checks the seller role's detached signature over the exact unsigned 005 payment state and its canonical relation to the 002 opening proof. It does not merge the buyer signature or submit the update.

type SellerPoolOpeningHooks

SellerPoolOpeningHooks supplies signing, verification, persistence, and submission for seller-side opening.

type SellerPoolOpeningHooks interface {
PendingOpeningProofStore
RefundTxSigner
TransactionIDCalculator
FundingTxVerifier
TransactionSubmitter
}

type SellerPoolPort

SellerPoolPort exposes seller-side pool validation, signing, and payment merge operations.

type SellerPoolPort interface {
TransactionID([]byte) (Hash32, error)
FundingTxID([]byte) (Hash32, error)
BuildRefundSubmission(*OpeningProof) ([]byte, error)
VerifyOpening(*OpeningProof) error
ParsePaymentState(context.Context, []byte, *OpeningProof) (*PaymentState, error)
ParseUnsignedPayment(context.Context, []byte, *OpeningProof) (*UnsignedPayment, error)
VerifyAcceptedPayment(*PaymentState, *OpeningProof) error
VerifyArbitratedPayment(*PaymentState, *OpeningProof) error
VerifyBuyerPayment(*UnsignedPayment, []byte, *OpeningProof) error
VerifySellerPayment(*UnsignedPayment, []byte, *OpeningProof) error
CheckPaymentCapacity(context.Context, PaymentUpdateInput) error
BuildPaymentUpdate(context.Context, PaymentUpdateInput) (*UnsignedPayment, error)
SignSellerArbitrationCandidate(context.Context, *UnsignedPayment, Signer) ([]byte, error)
SignSellerPayment(context.Context, *UnsignedPayment, Signer) ([]byte, error)
MergeBuyerSellerPayment(*UnsignedPayment, []byte, []byte) (*SignedPayment, error)
MergeSellerArbiterPayment(*UnsignedPayment, []byte, []byte) (*SignedPayment, error)
SignImmediateClose(context.Context, *UnsignedPayment, []byte, Signer) (*SignedPayment, error)
}

type SignatureVerifier

SignatureVerifier validates a detached signature over the exact supplied bytes and public key; it must not normalize or re-encode the payload.

type SignatureVerifier interface {
Verify(pubkey, payload, signature []byte) error
}

type SignedPayment

SignedPayment contains one detached role signature over an unsigned payment transaction.

type SignedPayment struct {
State PaymentState
RawTx []byte
}

func CloneSignedPayment

func CloneSignedPayment(payment *SignedPayment) *SignedPayment

CloneSignedPayment returns an independent copy of SignedPayment, including copies of mutable byte slices.

type Signer

Signer exposes the public key and detached signatures used by credentials and pool transactions. Implementations retain private-key custody outside the SDK.

type Signer interface {
PublicKey(context.Context) ([]byte, error)
Sign(context.Context, []byte) ([]byte, error)
}

type TransactionIDCalculator

TransactionIDCalculator computes a canonical 32-byte transaction identifier from raw transaction bytes.

type TransactionIDCalculator interface {
TransactionID(context.Context, []byte) (Hash32, error)
}

type TransactionSubmitter

TransactionSubmitter broadcasts a raw transaction to the network and returns its canonical transaction ID.

type TransactionSubmitter interface {
SubmitTransaction(context.Context, []byte) (Hash32, error)
}

type UnsignedPayment

UnsignedPayment is the only transaction object accepted by single-sign methods. It contains no unlocking script and no embedded signature.

type UnsignedPayment struct {
SpendTxID Hash32
RawTx []byte
PaymentSequence uint32
BuyerAmountSat uint64
SellerAmountSat uint64
ArbiterAmountSat uint64
PoolOutputSatoshis uint64
PoolLockingScript []byte
}

type UpdateAcceptance

UpdateAcceptance describes the node acceptance result for a non-final payment update.

type UpdateAcceptance struct {
TxID Hash32
SpendTxID Hash32
PaymentSequence uint32
}

type VerifiedNonFinalPoolNode

VerifiedNonFinalPoolNode is the production-side adapter between workflow code and a concrete node client. It verifies the exact input, outputs, buyer authorization and final signature set available in rawTx before forwarding it, then verifies that the backend response describes the same accepted transaction and sequence.

type VerifiedNonFinalPoolNode struct {
// contains filtered or unexported fields
}

func NewVerifiedNonFinalPoolNode

func NewVerifiedNonFinalPoolNode(engine PoolNodeVerifierPort, openings OpeningByFundingStore, backend NonFinalPoolBackend) (*VerifiedNonFinalPoolNode, error)

NewVerifiedNonFinalPoolNode requires a pool verifier, funding-indexed opening store, and backend. It returns an adapter that validates bytes and backend responses before exposing node acceptance to a workflow.

func (*VerifiedNonFinalPoolNode) SubmitFinal

func (node *VerifiedNonFinalPoolNode) SubmitFinal(ctx context.Context, rawTx []byte) (Hash32, error)

SubmitFinal validates a final close or expired refund, submits it to the backend, and requires the returned transaction ID to match the raw bytes.

func (*VerifiedNonFinalPoolNode) SubmitUpdate

func (node *VerifiedNonFinalPoolNode) SubmitUpdate(ctx context.Context, rawTx []byte) (*UpdateAcceptance, error)

SubmitUpdate validates a non-final state, submits it to the backend, and requires the returned transaction ID, spend anchor, and sequence to match.

Generated by gomarkdoc